/** * Generates a {@link DriverManager} URL from the other properties supplied. * * @return {@link DriverManager} URL from the other properties supplied */ public String getURL() { return getUrl(); }
/** * Gets a connection to the PostgreSQL database. The database is identified by the * DataSource properties serverName, databaseName, and portNumber. The user to * connect as is identified by the arguments user and password, which override * the DataSource properties by the same name. * * @return A valid database connection. * @throws SQLException * Occurs when the database connection cannot be established. */ public Connection getConnection(String user, String password) throws SQLException { try { Connection con = DriverManager.getConnection(getUrl(), user, password); if (logger != null) { logger.println("Created a non-pooled connection for " + user + " at " + getUrl()); } return con; } catch (SQLException e) { if (logger != null) { logger.println("Failed to create a non-pooled connection for " + user + " at " + getUrl() + ": " + e); } throw e; } }
/** * Gets a connection to the PostgreSQL database. The database is identified by the DataSource * properties serverName, databaseName, and portNumber. The user to connect as is identified by * the arguments user and password, which override the DataSource properties by the same name. * * @param user user * @param password password * @return A valid database connection. * @throws SQLException Occurs when the database connection cannot be established. */ public Connection getConnection(String user, String password) throws SQLException { try { Connection con = DriverManager.getConnection(getUrl(), user, password); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Created a {0} for {1} at {2}", new Object[]{getDescription(), user, getUrl()}); } return con; } catch (SQLException e) { LOGGER.log(Level.FINE, "Failed to create a {0} for {1} at {2}: {3}", new Object[]{getDescription(), user, getUrl(), e}); throw e; } }
/** * Gets a connection to the PostgreSQL database. The database is identified by the * DataSource properties serverName, databaseName, and portNumber. The user to * connect as is identified by the arguments user and password, which override * the DataSource properties by the same name. * * @return A valid database connection. * @throws SQLException * Occurs when the database connection cannot be established. */ public Connection getConnection(String user, String password) throws SQLException { try { Connection con = DriverManager.getConnection(getUrl(), user, password); if (logger != null) { logger.println("Created a non-pooled connection for " + user + " at " + getUrl()); } return con; } catch (SQLException e) { if (logger != null) { logger.println("Failed to create a non-pooled connection for " + user + " at " + getUrl() + ": " + e); } throw e; } }
/** * Gets a connection to the PostgreSQL database. The database is identified by the * DataSource properties serverName, databaseName, and portNumber. The user to * connect as is identified by the arguments user and password, which override * the DataSource properties by the same name. * * @return A valid database connection. * @throws SQLException * Occurs when the database connection cannot be established. */ public Connection getConnection(String user, String password) throws SQLException { try { Connection con = DriverManager.getConnection(getUrl(), user, password); if (logger != null) { logger.println("Created a non-pooled connection for " + user + " at " + getUrl()); } return con; } catch (SQLException e) { if (logger != null) { logger.println("Failed to create a non-pooled connection for " + user + " at " + getUrl() + ": " + e); } throw e; } }