You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by mi...@apache.org on 2009/07/17 22:35:51 UTC
svn commit: r795218 - in
/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql:
DBDictionaryFactory.java InformixDictionary.java
Author: mikedd
Date: Fri Jul 17 20:35:51 2009
New Revision: 795218
URL: http://svn.apache.org/viewvc?rev=795218&view=rev
Log:
OPENJPA-973: allow DB2 jcc driver to access Informix
Merged to 1.3.x
Submitted by: Fay Wang
modified: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
modified: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
Modified:
openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java?rev=795218&r1=795217&r2=795218&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java (original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java Fri Jul 17 20:35:51 2009
@@ -73,9 +73,9 @@
*/
public static DBDictionary calculateDBDictionary(JDBCConfiguration conf,
String url, String driver, String props) {
- String dclass = dictionaryClassForString(driver, conf);
+ String dclass = dictionaryClassForString(getProtocol(url), conf);
if (dclass == null)
- dclass = dictionaryClassForString(getProtocol(url), conf);
+ dclass = dictionaryClassForString(driver, conf);
if (dclass == null)
return null;
return newDBDictionary(conf, dclass, props);
Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java?rev=795218&r1=795217&r2=795218&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java (original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java Fri Jul 17 20:35:51 2009
@@ -73,6 +73,7 @@
*/
public boolean swapSchemaAndCatalog = true;
+ protected boolean useJCC = false;
// weak set of connections we've already executed lock mode sql on
private final Collection _seenConnections = new ReferenceHashSet
(ReferenceHashSet.WEAK);
@@ -155,10 +156,19 @@
super.connectedConfiguration(conn);
if (driverVendor == null) {
DatabaseMetaData meta = conn.getMetaData();
- if ("Informix".equalsIgnoreCase(meta.getDriverName()))
+ String driverName = meta.getDriverName();
+ if ("Informix".equalsIgnoreCase(driverName))
driverVendor = VENDOR_DATADIRECT;
else
driverVendor = VENDOR_OTHER;
+
+ if (driverName.equals("IBM DB2 JDBC Universal Driver Architecture")) {
+ useJCC = true;
+ try {
+ if (meta.storesLowerCaseIdentifiers())
+ schemaCase = SCHEMA_CASE_LOWER;
+ } catch (SQLException e) {}
+ }
}
if (isJDBC3) {
conn.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT);
@@ -301,5 +311,15 @@
return false;
return true;
}
+
+ public boolean useJCC() {
+ return useJCC;
+ }
+
+ /**
+ * Return DB specific schemaCase
+ */
+ public String getSchemaCase(){
+ return schemaCase;
+ }
}
-