Author: faywang
Date: Thu Jan 21 17:03:33 2010
New Revision: 901775
URL: http://svn.apache.org/viewvc?rev=901775&view=rev
Log:
OPENJPA-1455: VALUES CURRENT SCHEMA fails in DB2 on zOS. Change the SQL to
SELECT CURRENT SCHEMA FROM SYSIBM.SYSDUMMY1.
Modified:
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
Modified:
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?rev=901775&r1=901774&r2=901775&view=diff
==============================================================================
---
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
(original)
+++
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
Thu Jan 21 17:03:33 2010
@@ -274,16 +274,21 @@
super.connectedConfiguration(conn);
DatabaseMetaData metaData = conn.getMetaData();
- String str = "VALUES CURRENT SCHEMA";
- Statement stmnt = conn.createStatement();
- ResultSet rs = stmnt.executeQuery(str);
- if (rs.next()) {
- String currSchema = rs.getString(1);
- if (currSchema != null)
- setDefaultSchemaName(currSchema.trim());
+ try {
+ String str = "SELECT CURRENT SCHEMA FROM SYSIBM.SYSDUMMY1";
+ Statement stmnt = conn.createStatement();
+ ResultSet rs = stmnt.executeQuery(str);
+ if (rs.next()) {
+ String currSchema = rs.getString(1);
+ if (currSchema != null)
+ setDefaultSchemaName(currSchema.trim());
+ }
+ rs.close();
+ stmnt.close();
+ } catch (SQLException e) {
+ if (log.isTraceEnabled())
+ log.trace(_loc.get("can_not_get_current_schema",
e.getMessage()));
}
- rs.close();
- stmnt.close();
String driverName = metaData.getDriverName();
if (driverName != null && driverName.startsWith("IBM DB2"))
Modified:
openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties?rev=901775&r1=901774&r2=901775&view=diff
==============================================================================
---
openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
(original)
+++
openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
Thu Jan 21 17:03:33 2010
@@ -204,3 +204,4 @@
identifiers. The default value of "preserve" will be used.
unknown-delim-support: Unable to determine whether delimited identifiers are
supported. \
The use of delimiters will not be supported.
+can_not_get_current_schema: Unable to get current schema. SQLException message
is "{0}".
\ No newline at end of file