OPENJPA-1455: VALUES CURRENT SCHEMA fails in DB2 on zOS. Change the SQL to SELECT CURRENT SCHEMA FROM SYSIBM.SYSDUMMY1.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@901775 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Fay Wang 2010-01-21 17:03:33 +00:00
parent bad0838e00
commit b08a0d179b
2 changed files with 15 additions and 9 deletions

View File

@ -274,16 +274,21 @@ public class DB2Dictionary
super.connectedConfiguration(conn); super.connectedConfiguration(conn);
DatabaseMetaData metaData = conn.getMetaData(); DatabaseMetaData metaData = conn.getMetaData();
String str = "VALUES CURRENT SCHEMA"; try {
Statement stmnt = conn.createStatement(); String str = "SELECT CURRENT SCHEMA FROM SYSIBM.SYSDUMMY1";
ResultSet rs = stmnt.executeQuery(str); Statement stmnt = conn.createStatement();
if (rs.next()) { ResultSet rs = stmnt.executeQuery(str);
String currSchema = rs.getString(1); if (rs.next()) {
if (currSchema != null) String currSchema = rs.getString(1);
setDefaultSchemaName(currSchema.trim()); 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(); String driverName = metaData.getDriverName();
if (driverName != null && driverName.startsWith("IBM DB2")) if (driverName != null && driverName.startsWith("IBM DB2"))

View File

@ -204,3 +204,4 @@ cannot-determine-identifier-case: Unable to determine the case to use for delimi
identifiers. The default value of "preserve" will be used. identifiers. The default value of "preserve" will be used.
unknown-delim-support: Unable to determine whether delimited identifiers are supported. \ unknown-delim-support: Unable to determine whether delimited identifiers are supported. \
The use of delimiters will not be supported. The use of delimiters will not be supported.
can_not_get_current_schema: Unable to get current schema. SQLException message is "{0}".