Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 05AA0C496 for ; Tue, 29 May 2012 08:54:16 +0000 (UTC) Received: (qmail 33197 invoked by uid 500); 29 May 2012 08:54:15 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 33076 invoked by uid 500); 29 May 2012 08:54:15 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 33050 invoked by uid 99); 29 May 2012 08:54:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2012 08:54:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2012 08:54:12 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A79982388860; Tue, 29 May 2012 08:53:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cxf.apache.org From: ay@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120529085352.A79982388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(); }