List of utility methods to do JDBC PostgreSQL Connection
Connection | getPostgresSQLConnection(String hostname, int portNumber, String databaseName, String dbuser, String dbpasswort) Gets the postgres sql connection from the given parameters. StringBuilder sb = new StringBuilder(); sb.append(POSTGRESQL_PREFIX_URL); sb.append(hostname); sb.append(":"); sb.append(portNumber); sb.append("/"); sb.append(databaseName); Class.forName(POSTGRESQL_DRIVERNAME); ... |
void | resetTestDB() reset Test DB if (connection == null) { try { connection = DriverManager.getConnection("jdbc:postgresql://localhost:5432/wegas_test", "user", "1234"); try (Statement st = connection.createStatement()) { st.execute("DROP SCHEMA public CASCADE;"); st.execute("CREATE SCHEMA public;"); connection.commit(); } catch (SQLException ex) { System.out.println("Error creating database"); |