protected void validateProperties( final String userName, final String password) throws java.sql.SQLException { super.validateProperties(userName, password); String reason = reasonWhyInvalidPortNumber(this.portNumber); if ( reason != null ) { throw createConnectionError(reason); } reason = reasonWhyInvalidServerName(this.serverName); if ( reason != null ) { throw createConnectionError(reason); } }
protected void validateProperties( final String userName, final String password) throws java.sql.SQLException { super.validateProperties(userName, password); String reason = reasonWhyInvalidPortNumber(this.portNumber); if ( reason != null ) { throw createConnectionError(reason); } reason = reasonWhyInvalidServerName(this.serverName); if ( reason != null ) { throw createConnectionError(reason); } }
/** * Attempt to establish a database connection. * @param userName the database user on whose behalf the Connection is being made * @param password the user's password * @return a Connection to the database * @throws java.sql.SQLException if a database-access error occurs * @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String) */ public Connection getConnection(String userName, String password) throws java.sql.SQLException { // check if this is embedded connection if (getServerName() == null) { super.validateProperties(userName, password); final Properties props = buildEmbeddedProperties(userName, password); String url = new JDBCURL(getDatabaseName(), null, null).getJDBCURL(); return driver.connect(url, props); } // if not proceed with socket connection. validateProperties(userName,password); final Properties props = buildProperties(userName, password); return driver.connect(new JDBCURL(this.getDatabaseName(), buildServerURL(), null).getJDBCURL(), props); }
/** * Attempt to establish a database connection. * @param userName the database user on whose behalf the Connection is being made * @param password the user's password * @return a Connection to the database * @throws java.sql.SQLException if a database-access error occurs * @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String) */ public Connection getConnection(String userName, String password) throws java.sql.SQLException { // check if this is embedded connection if (getServerName() == null) { super.validateProperties(userName, password); final Properties props = buildEmbeddedProperties(userName, password); String url = new JDBCURL(getDatabaseName(), null, null).getJDBCURL(); return driver.connect(url, props); } // if not proceed with socket connection. validateProperties(userName,password); final Properties props = buildProperties(userName, password); return driver.connect(new JDBCURL(this.getDatabaseName(), buildServerURL(), null).getJDBCURL(), props); }