1 21 22 package uk.org.primrose.pool.core; 23 import java.sql.*; 24 25 public class NewConnection { 26 27 public Connection get(String driverClass, String driverURL, String user, String password) { 28 try { 29 Class.forName(driverClass); 30 Connection conn = DriverManager.getConnection(driverURL, user, password); 31 return conn; 32 } catch (ClassNotFoundException cnfe) { 33 System.err.println("[NewConnection] Cannot connect to DB (ClassNotFoundException)... " +driverClass +" - " +cnfe); 34 return null; 35 } catch (SQLException sqle) { 36 System.err.println("[NewConnection] Cannot connect to DB (SQLException)... " +driverURL +" - " +sqle); 38 return null; 39 } 40 } 41 42 } 43 | Popular Tags |