diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java index 8db475103..560c15dfd 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java @@ -189,6 +189,7 @@ public class DataSourceFactory { DataSource inner = ds.getInnermostDelegate(); if (inner instanceof DriverDataSource) ((DriverDataSource) inner).initDBDictionary(dict); + Connection conn = null; try { // add the dictionary as a warning handler on the logging @@ -219,9 +220,26 @@ public class DataSourceFactory { // allow the dbdictionary to decorate the connection further ds.addDecorator(dict); + + // ensure dbdictionary to process connectedConfiguration() + if (!factory2) + conn = ds.getConnection(conf.getConnectionUserName(), conf + .getConnectionPassword()); + else + conn = ds.getConnection(conf.getConnection2UserName(), conf + .getConnection2Password()); + return ds; } catch (Exception e) { throw new StoreException(e).setFatal(true); + } finally { + if (conn != null) + try { + conn.close(); + } catch (SQLException se) { + // ignore any exception since the connection is not going + // to be used anyway + } } } diff --git a/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties b/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties index 26be53c72..d48c00946 100644 --- a/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties +++ b/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties @@ -238,8 +238,8 @@ ConnectionURL-values: jdbc:JSQLConnect:///database=,\ jdbc:dbaw://:8889/ connecting-for-dictionary: OpenJPA will now connect to the database to attempt \ - to determine what type of database dictionary to use. To prevent this \ - connection in the future, set your openjpa.jdbc.DBDictionary \ + to determine what type of database dictionary to use. You may prevent this \ + connection in the future by setting your openjpa.jdbc.DBDictionary \ configuration property to the appropriate value for your database (see \ the documentation for available values). map-factory: Using mapping factory "{0}".