Source:
<code>public Connection connect(String url, Properties info) throws SQLException { Properties defaults; if (!url.startsWith("jdbc:postgresql:")) { return null; } try { defaults = getDefaultProperties(); } catch (IOException ioe) { throw new PSQLException(GT.tr("Error loading default settings from driverconfig.properties"), PSQLState.UNEXPECTED_ERROR, ioe); } Properties props = new Properties(defaults); if (info != null) { Set<String> e = info.stringPropertyNames(); for (String propName : e) { String propValue = info.getProperty(propName); if (propValue == null) { throw new PSQLException( GT.tr("Properties for the driver contains a non-string value for the key ") + propName, PSQLState.UNEXPECTED_ERROR); } props.setProperty(propName, propValue); } } if ((props = parseURL(url, props)) == null) { LOGGER.log(Level.SEVERE, "Error in url: {0}", url); return null; } try { setupLoggerFromProperties(props); LOGGER.log(Level.FINE, "Connecting with URL: {0}", url); long timeout = timeout(props); if (timeout <= 0) { return makeConnection(url, props); } ConnectThread ct = new ConnectThread(url, props); Thread thread = new Thread(ct, "PostgreSQL JDBC driver connection thread"); thread.setDaemon(true); thread.start(); return ct.getResult(timeout); } catch (PSQLException ex1) { <START> LOGGER.log(Level.WARNING, "Connection error: {0}", ex1.getServerErrorMessage()); <END> throw ex1; } catch (java.security.AccessControlException ace) { throw new PSQLException( GT.tr( "Your security policy has prevented the connection from being attempted. You probably need to grant the connect java.net.SocketPermission to the database server host and port that you wish to connect to."), PSQLState.UNEXPECTED_ERROR, ace); } catch (Exception ex2) { LOGGER.log(Level.WARNING, "Unexpected connection error."); throw new PSQLException( GT.tr( "Something unusual has occurred to cause the driver to fail. Please report this exception."), PSQLState.UNEXPECTED_ERROR, ex2); } }</code><technical_language>do replace ex1 getServerErrorMessage</technical_language>

Target:
public Connection connect(String url, Properties info) throws SQLException { Properties defaults; if (!url.startsWith("jdbc:postgresql:")) { return null; } try { defaults = getDefaultProperties(); } catch (IOException ioe) { throw new PSQLException(GT.tr("Error loading default settings from driverconfig.properties"), PSQLState.UNEXPECTED_ERROR, ioe); } Properties props = new Properties(defaults); if (info != null) { Set<String> e = info.stringPropertyNames(); for (String propName : e) { String propValue = info.getProperty(propName); if (propValue == null) { throw new PSQLException( GT.tr("Properties for the driver contains a non-string value for the key ") + propName, PSQLState.UNEXPECTED_ERROR); } props.setProperty(propName, propValue); } } if ((props = parseURL(url, props)) == null) { LOGGER.log(Level.SEVERE, "Error in url: {0}", url); return null; } try { setupLoggerFromProperties(props); LOGGER.log(Level.FINE, "Connecting with URL: {0}", url); long timeout = timeout(props); if (timeout <= 0) { return makeConnection(url, props); } ConnectThread ct = new ConnectThread(url, props); Thread thread = new Thread(ct, "PostgreSQL JDBC driver connection thread"); thread.setDaemon(true); thread.start(); return ct.getResult(timeout); } catch (PSQLException ex1) { LOGGER.log(Level.WARNING, "Connection error: {0}", ex1.getServerErrorMessage()); throw ex1; } catch (java.security.AccessControlException ace) { throw new PSQLException( GT.tr( "Your security policy has prevented the connection from being attempted. You probably need to grant the connect java.net.SocketPermission to the database server host and port that you wish to connect to."), PSQLState.UNEXPECTED_ERROR, ace); } catch (Exception ex2) { LOGGER.log(Level.WARNING, "Unexpected connection error: {0}", ex2.getMessage()); throw new PSQLException( GT.tr( "Something unusual has occurred to cause the driver to fail. Please report this exception."), PSQLState.UNEXPECTED_ERROR, ex2); } }