Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DBConnection {
- static Connection connection;
- static org.postgresql.jdbc2.optional.ConnectionPool connectionPool = new ConnectionPool();
- public DBConnection() throws SQLException {
- System.out.println("-------- PostgreSQL "
- + "JDBC Connection Testing ------------");
- try {
- Class.forName("org.postgresql.Driver");
- } catch (ClassNotFoundException e) {
- System.out.println("Where is your PostgreSQL JDBC Driver? "
- + "Include in your library path!");
- e.printStackTrace();
- return;
- }
- System.out.println("PostgreSQL JDBC Driver Registered!");
- connectionPool.setUser("postgres");
- connectionPool.setPassword("toor");
- connectionPool.setUrl("jdbc:postgresql://127.0.0.1:5432/bank_database");
- connectionPool.setSspiServiceClass("org.postgresql.Driver");
- connection = DriverManager.getConnection(
- "jdbc:postgresql://127.0.0.1:5432/bank_database", "postgres",
- "toor");
- System.out.println(connectionPool.getConnection().toString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement