Index: KeyDbDriverWrapper.java =================================================================== RCS file: /CVSROOT/yahoo/packages/yahoo/java/yjava_jdbc_wrappers/src/mysql/yjava/database/jdbc/mysql/KeyDbDriverWrapper.java,v retrieving revision 1.5 diff -u -r1.5 KeyDbDriverWrapper.java --- KeyDbDriverWrapper.java 24 Sep 2008 21:02:02 -0000 1.5 +++ KeyDbDriverWrapper.java 9 Oct 2008 23:21:49 -0000 @@ -42,49 +42,50 @@ } public static void premain(String options, Instrumentation inst) {} + private static String password = null; + public KeyDbDriverWrapper() throws SQLException { super(); } @Override - public Connection connect(String s, Properties properties) throws SQLException { - if (!acceptsURL(s)) { - return null; - } - Properties propertiesCopy = replacePassword(properties); + public Connection connect(String s, Properties properties) throws SQLException { + if (!acceptsURL(s)) { + return null; + } - Connection connection = super.connect(s, propertiesCopy); + replacePassword(properties); + Connection connection = super.connect(s, properties); - return connection; - } + return connection; + } static Properties replacePassword(Properties properties) throws SQLException { - Properties propertiesCopy = new Properties(); - propertiesCopy.putAll(properties); - String key = propertiesCopy.getProperty(NonRegisteringDriver.PASSWORD_PROPERTY_KEY); + if(password == null) { - if (null == key) { - throw new SQLException("Password key is not set"); - } + String key = properties.getProperty(NonRegisteringDriver.PASSWORD_PROPERTY_KEY); - String password = null; + if (null == key) { + throw new SQLException("Password key is not set"); + } - try { - YCR ycr = YCR.createYCR(YCR.NATIVE_YCR); + try { + YCR ycr = YCR.createYCR(YCR.NATIVE_YCR); - password = ycr.getKey(key); + password = ycr.getKey(key); - } catch (Exception ex) { - throw new SQLException("Error retrieving password from KeyDB", ex); - } + } catch (Exception ex) { + throw new SQLException("Error retrieving password from KeyDB", ex); + } - if (null == password) { - throw new SQLException("Password not found in keyDB, key: " + key); - } + if (null == password) { + throw new SQLException("Password not found in keyDB, key: " + key); + } + } - propertiesCopy.setProperty(NonRegisteringDriver.PASSWORD_PROPERTY_KEY, password); - return propertiesCopy; + properties.setProperty(NonRegisteringDriver.PASSWORD_PROPERTY_KEY, password); + return properties; } }