cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1343603 - in /cxf/branches/2.5.x-fixes: ./ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
Date Tue, 29 May 2012 08:53:52 GMT
Author: ay
Date: Tue May 29 08:53:52 2012
New Revision: 1343603

URL: http://svn.apache.org/viewvc?rev=1343603&view=rev
Log:
Merged revisions 1343597 via  svn merge from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1343597 | ay | 2012-05-29 10:27:47 +0200 (Tue, 29 May 2012) | 1 line
  
  support other DBs for CXF-4249
........

Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java

Propchange: cxf/branches/2.5.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java?rev=1343603&r1=1343602&r2=1343603&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
Tue May 29 08:53:52 2012
@@ -119,8 +119,12 @@ public class RMTxStore implements RMStor
     private static final String SELECT_MESSAGES_STMT_STR =
         "SELECT MSG_NO, SEND_TO, CONTENT FROM {0} WHERE SEQ_ID = ?";
     
+    // create_schema may not work for several reasons, if so, create one manually
     private static final String CREATE_SCHEMA_STMT_STR = "CREATE SCHEMA {0}";
-    private static final String SET_CURRENT_SCHEMA_STMT_STR = "SET CURRENT SCHEMA {0}";
+    // given the schema, try these standard statements to switch to the schema
+    private static final String[] SET_SCHEMA_STMT_STRS = {"SET SCHEMA {0}",
+                                                          "SET CURRENT_SCHEMA = {0}",
+                                                          "ALTER SESSION SET CURRENT_SCHEMA
= {0}"};
     
     private static final String DERBY_TABLE_EXISTS_STATE = "X0Y32";
     private static final int ORACLE_TABLE_EXISTS_CODE = 955;
@@ -655,15 +659,23 @@ public class RMTxStore implements RMStor
             stmt.executeUpdate(MessageFormat.format(CREATE_SCHEMA_STMT_STR, 
                                                     schemaName));
         } catch (SQLException ex) {
-            // pass through to assume it is already created
+            // assume it is already created or no authorization is provided (create one manually)
         }
         stmt.close();
         stmt = connection.createStatement();
-        try {
-            stmt.executeUpdate(MessageFormat.format(SET_CURRENT_SCHEMA_STMT_STR, 
-                                                    schemaName));
-        } catch (SQLException ex) {
-            throw ex;
+        SQLException ex0 = null;
+        for (int i = 0; i < SET_SCHEMA_STMT_STRS.length; i++) {
+            try {
+                stmt.executeUpdate(MessageFormat.format(SET_SCHEMA_STMT_STRS[i], schemaName));
+                break;
+            } catch (SQLException ex) {
+                ex.setNextException(ex0);
+                ex0 = ex;
+                if (i == SET_SCHEMA_STMT_STRS.length - 1) {
+                    throw ex0;
+                }
+                // continue
+            }
         }
         stmt.close();
     }



Mime
View raw message