Topic
5 replies Latest Post - ‏2013-11-25T10:40:22Z by melon123
melon123
melon123
3 Posts
ACCEPTED ANSWER

Pinned topic Unwrap OracleConnection on Liberty profile DSRA9122E

‏2013-11-22T09:06:34Z |

Hi,

I tried unwrap native OracleConnection on Liberty profile 8.5.5 and ojdbc6.

server.xml

<server description="new server">
    <!-- Enable features -->
    <featureManager>
        <feature>jsp-2.2</feature>
        <feature>jaxrs-1.1</feature>
        <feature>jaxws-2.2</feature>
        <feature>jaxb-2.2</feature>
        <feature>servlet-3.0</feature>
        <feature>jdbc-4.0</feature>
    </featureManager>
    <httpEndpoint id="defaultHttpEndpoint" host="localhost" httpPort="9080" httpsPort="9443"/>
    <dataSource jndiName="jdbc/db" id="jdbc/db" type="javax.sql.DataSource" jdbcDriverRef="OracleDriver">
        <properties.oracle user="***" password="***" URL="jdbc:oracle:thin:@***:1521:***"/>
    </dataSource>
    <jdbcDriver id="OracleDriver" libraryRef="OracleLib" javax.sql.DataSource="oracle.jdbc.pool.OracleDataSource"/>
    <library id="OracleLib">
        <fileset dir="lib" includes="ojdbc6.jar"/>
    </library>
    <application location="app.war">
        <classloader commonLibraryRef="OracleLib"/>
    </application>
</server>

code:

        envContext = new InitialContext();
        Context initContext  = (Context)envContext.lookup("java:comp/env");
        DataSource ds = (DataSource)initContext.lookup("jdbc/db");
        Connection conn = ds.getConnection();
        oracle.jdbc.OracleConnection oracleConnection = conn.unwrap(oracle.jdbc.OracleConnection.class);
 

During unwrap I have exception:

Exception = java.sql.SQLException
Source = com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.unwrap
probeid = 441
Stack Dump = java.sql.SQLException: DSRA9122E: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection@1708fc8 does not wrap any objects of type oracle.jdbc.OracleConnection.
    at com.ibm.ws.rsadapter.jdbc.WSJdbcWrapper.unwrap(WSJdbcWrapper.java:495)
    at xxx.yyy.zzz(yyy.java:458)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)
    at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:66)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)
    at com.ibm.ws.jaxws.endpoint.AbstractJaxWsWebEndpoint.invoke(AbstractJaxWsWebEndpoint.java:138)
    at com.ibm.ws.jaxws.webcontainer.LibertyJaxWsServlet.handleRequest(LibertyJaxWsServlet.java:135)
    at com.ibm.ws.jaxws.webcontainer.LibertyJaxWsServlet.doPost(LibertyJaxWsServlet.java:94)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at com.ibm.ws.jaxws.webcontainer.LibertyJaxWsServlet.service(LibertyJaxWsServlet.java:86)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:461)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1060)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4510)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:282)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:954)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:252)
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:584)
    at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:439)
    at com.ibm.ws.threading.internal.Worker.run(Worker.java:421)
    at java.lang.Thread.run(Thread.java:662)

Dump of callerThis
Object type = com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
  strings[0] = "_______________________________________________________________________"
  strings[1] = ""
  strings[2] = "    First Failure Data Capture information for"
  strings[3] = "          com.ibm.ws.rsadapter.jdbc.WSJdbcConnection@1708fc8"
  strings[4] = "_______________________________________________________________________"
  strings[5] = ""
  strings[6] = "com.ibm.ws.rsadapter.jdbc.WSJdbcConnection@1708fc8
"
  strings[7] = "Transaction Manager global transaction status is"
  strings[8] = "  STATUS NO TRANSACTION (6)
"
  strings[9] = "Underlying Connection: oracle.jdbc.driver.T4CConnection@a410c0"
  strings[10] = "  oracle.jdbc.driver.T4CConnection@a410c0
"
  strings[11] = "Key Object:"
  strings[12] = "  [B@666df2
"
  strings[13] = "DataStoreHelper:"
  strings[14] = "  com.ibm.websphere.rsadapter.Oracle11gDataStoreHelper@113a6b9
"
  strings[15] = "Connection Manager:"
  strings[16] = "  [ConnectionManager]@126bd42
JNDI Name <jdbc/db>
shareable <true>

"
  strings[17] = "ConnectionManager supports lazy association?"
  strings[18] = "  true
"
  strings[19] = "ConnectionManager supports lazy enlistment?"
  strings[20] = "  true
"
  strings[21] = "Handle is reserved? false
"
  strings[22] = "AutoCommit value tracked by handle: true
"
  strings[23] = "Thread id:"
  strings[24] = "  null
"
  strings[25] = "Wrapper State: "
  strings[26] = "  ACTIVE
"
  strings[27] = "Parent wrapper:"
  strings[28] = "  null
"
  strings[29] = "Child wrapper:
"
  strings[30] = "  null"
  strings[31] = "# of Child Wrappers 1
"
  strings[32] = "Child wrappers:
"
  strings[33] = "  com.ibm.ws.rsadapter.jdbc.WSJdbcStatement@efd1c1"
  strings[34] = ""
  strings[35] = ""
  strings[36] = "ConnectionRequestInfo:"
  strings[37] = "  null
"
  strings[38] = "_______________________________________________________________________"
  strings[39] = ""
  strings[40] = "    First Failure Data Capture information for"
  strings[41] = "          com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl@537945"
  strings[42] = "_______________________________________________________________________"
  strings[43] = ""
  strings[44] = "com.ibm.ws.rsadapter.DSConfig@3ec61b"
  strings[45] = "[beginTranForResultSetScrollingAPIs, true, beginTranForVendorAPIs, true, commitOrRollbackOnCleanup, null, connectionSharing, 0, isolationLevel, -1, jndiName, jdbc/db, queryTimeout, null, statementCacheSize, 10, supplementalJDBCTrace, null, syncQueryTimeoutWithTransactionTimeout, false, transactional, true]"
  strings[46] = "[com.ibm.ws.classloading.internal.AppClassLoader@97953, true, ExceptionChecking, com.ibm.websphere.rsadapter.Oracle11gDataStoreHelper@113a6b9, com.ibm.ws.rsadapter.spi.InternalOracle11gDataStoreHelper@14047fa, false, interface javax.sql.DataSource]"
  strings[47] = "{URL=...}"
  strings[48] = "Resource Adapter:"
  strings[49] = "  null
"
  strings[50] = "Database Type:"
  strings[51] = "  null
"
  strings[52] = "Description:"
  strings[53] = "  null
"
  strings[54] = "Log Writer:"
  strings[55] = "  null
"
  strings[56] = "Transaction Branches are set to be Loosely Coupled: "
  strings[57] = "  false
"
  strings[58] = "Counter of fatal connection errors on ManagedConnections created by this MCF:"
  strings[59] = "  0
"
  strings[60] = "Validate existing connections on cleanup after a fatal connection error is detected?"
  strings[61] = "  true
"
  strings[62] = "ResetConnectionByBackendDatabase: "
  strings[63] = "  false
"
  strings[64] = "Backend id checking is: "
  strings[65] = "  true
"
  strings[66] = "JMSOnePhaseOptimization: "
  strings[67] = "  false
"
  strings[68] = "Reauthentication: "
  strings[69] = "  false
"
  strings[70] = "newDBConnectionValidationEnabled: "
  strings[71] = "  false
"
  strings[72] = "connectionRetriesDuringDBFailover: "
  strings[73] = "  100
"
  strings[74] = "connRetryDurationDuringDBFailover: "
  strings[75] = "  3000
"
  strings[76] = "Failover count: "
  strings[77] = "  0
"
  strings[78] = "OracleImplicitConnectionPooling enabled: "
  strings[79] = "  false
"
  strings[80] = ""
  strings[81] = "_______________________________________________________________________"
  strings[82] = ""
  strings[83] = "    First Failure Data Capture information for"
  strings[84] = "          com.ibm.ws.rsadapter.spi.WSRdbDataSource@1358b73"
  strings[85] = "_______________________________________________________________________"
  strings[86] = ""
  strings[87] = "DataSource Implementation Class Name:"
  strings[88] = "  oracle.jdbc.pool.OracleDataSource
"
  strings[89] = "DataSource Name:"
  strings[90] = "  null
"
  strings[91] = "DataStoreHelper:"
  strings[92] = "  com.ibm.websphere.rsadapter.Oracle11gDataStoreHelper@113a6b9
"
  strings[93] = "DataSource properties:"
  strings[94] = "  {URL=...}
"
  strings[95] = "ONE PHASE ENABLED
"
  strings[96] = "Underlying DataSource Object: oracle.jdbc.pool.OracleDataSource@56412e"
  strings[97] = "  oracle.jdbc.pool.OracleDataSource@56412e
"
  strings[98] = "Counter of unique, modified DataSource configurations: 0
"
  strings[99] = "Failover servers list: "
  strings[100] = "  [Ljava.lang.Object;@d1581c
"
  strings[101] = "_______________________________________________________________________"
  strings[102] = ""
  strings[103] = "    First Failure Data Capture information for"
  strings[104] = "          com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl@d40c6e"
  strings[105] = "_______________________________________________________________________"
  strings[106] = ""
  strings[107] = "ONE PHASE ENABLED
"
  strings[108] = "Connection sharing: "
  strings[109] = "  0
"
  strings[110] = "Database Type:"
  strings[111] = "  null
"
  strings[112] = "Transaction State:"
  strings[113] = "  NO_TRANSACTION_ACTIVE
"
  strings[114] = "Key:"
  strings[115] = "  [B@666df2
"
  strings[116] = "Log Writer:"
  strings[117] = "  null
"
  strings[118] = "Subject:"
  strings[119] = "  null
"
  strings[120] = "ManagedConnection:"
  strings[121] = "  WSRdbManagedConnectionImpl@d40c6e
"
  strings[122] = "Counter of fatal connection errors for the ManagedConnectionFactory as of the most recent getConnection on this ManagedConnection:"
  strings[123] = "  0
"
  strings[124] = "Default AutoCommit:"
  strings[125] = "  true
"
  strings[126] = "Current AutoCommit:"
  strings[127] = "  true
"
  strings[128] = "Current Isolation:"
  strings[129] = "  READ COMMITTED (2)
"
  strings[130] = "Isolation level has changed? :"
  strings[131] = "  false
"
  strings[132] = "Support isolation level switching: "
  strings[133] = "  false
"
  strings[134] = "The tc name is:
"
  strings[135] = "null
"
  strings[136] = "The tc original user is:
"
  strings[137] = "null
"
  strings[138] = "The tc releam  is:
"
  strings[139] = "null
"
  strings[140] = "The tc user security token is:
"
  strings[141] = "null
"
  strings[142] = "The connection wait Time for the mc is: "
  strings[143] = "  0
"
  strings[144] = "The j2eename is:
"
  strings[145] = "null
"
  strings[146] = "The gssCredential is:
"
  strings[147] = "null
"
  strings[148] = "The gssName is:
"
  strings[149] = "null
"
  strings[150] = "Catalog, IsReadOnly, or TypeMap has changed? :"
  strings[151] = "  false
"
  strings[152] = "Default Holdability:"
  strings[153] = "  DEFAULT CURSOR HOLDABILITY VALUE (0)
"
  strings[154] = "Current Holdability:"
  strings[155] = "  DEFAULT CURSOR HOLDABILITY VALUE (0)
"
  strings[156] = "Holdability value has changed? :"
  strings[157] = "  false
"
  strings[158] = "Thread ID:"
  strings[159] = "  null
"
  strings[160] = "Lazily enlisted in the current transaction? :"
  strings[161] = "  false
"
  strings[162] = "Underlying Connection Object: oracle.jdbc.driver.T4CConnection@a410c0"
  strings[163] = "  oracle.jdbc.driver.T4CConnection@a410c0
"
  strings[164] = "Underlying PooledConnection Object: null"
  strings[165] = "  null
"
  strings[166] = "SQLJ Default Context: null"
  strings[167] = "  null
"
  strings[168] = "Fatal connection error was detected? :"
  strings[169] = "  false
"
  strings[170] = "Currently cleaning up handles? :"
  strings[171] = "  false
"
  strings[172] = "Last ConnectionEvent sent for this ManagedConnection:
"
  strings[173] = "  com.ibm.ws.rsadapter.spi.WSConnectionEvent@1efa1f8"
  strings[174] = "  Connection Handle: null"
  strings[175] = "  Event ID: UNKNOWN CONNECTION EVENT CONSTANT (0)"
  strings[176] = "  Exception: null"
  strings[177] = ""
  strings[178] = "Connection Event Listeners:
"
  strings[179] = "  com.ibm.ejs.j2c.ConnectionEventListener@172a5e0"
  strings[180] = ""
  strings[181] = "Maximum Handle List Size: 15
"
  strings[182] = "Handle Count: 1
"
  strings[183] = "Handles:
"
  strings[184] = "  com.ibm.ws.rsadapter.jdbc.WSJdbcConnection@1708fc8"
  strings[185] = "  null"
  strings[186] = "  null"
  strings[187] = "  null"
  strings[188] = "  null"
  strings[189] = "  null"
  strings[190] = "  null"
  strings[191] = "  null"
  strings[192] = "  null"
  strings[193] = "  null"
  strings[194] = "  null"
  strings[195] = "  null"
  strings[196] = "  null"
  strings[197] = "  null"
  strings[198] = "  null"
  strings[199] = ""
  strings[200] = "State Manager:"
  strings[201] = "  com.ibm.ws.rsadapter.spi.WSStateManager@1e83fed
"
  strings[202] = "XA Resource:"
  strings[203] = "  null
"
  strings[204] = "_______________________________________________________________________"
  strings[205] = ""
  strings[206] = "    First Failure Data Capture information for"
  strings[207] = "          com.ibm.ws.rsadapter.spi.WSRdbSpiLocalTransactionImpl@bce6b6"
  strings[208] = "_______________________________________________________________________"
  strings[209] = ""
  strings[210] = "Connection:"
  strings[211] = "  oracle.jdbc.driver.T4CConnection@a410c0
"
  strings[212] = "ManagedConnection:"
  strings[213] = "  WSRdbManagedConnectionImpl@d40c6e
"
  strings[214] = "ManagedConnectionMetaData:"
  strings[215] = "  null
"
  strings[216] = "Statement Cache:"
  strings[217] = "  
com.ibm.ws.rsadapter.spi.CacheMap@1ced5e1
Number of entries:   0
Maximum entries:     10
Number of buckets:   13
Maximum bucket size: 5
Number of discards:  0

BUCKET SIZE PREV NEXT
  000  000  013  013
  001  000  013  013
  002  000  013  013
  003  000  013  013
  004  000  013  013
  005  000  013  013
  006  000  013  013
  007  000  013  013
  008  000  013  013
  009  000  013  013
  010  000  013  013
  011  000  013  013
  012  000  013  013
  013  LRU       014
  014  MRU  013

"
  strings[218] = "_______________________________________________________________________"
  strings[219] = ""
  strings[220] = "    First Failure Data Capture information for"
  strings[221] = "          com.ibm.ws.rsadapter.spi.WSConnectionRequestInfoImpl@3bb1f6"
  strings[222] = "_______________________________________________________________________"
  strings[223] = ""
  extention DS properties     = ""
  strings[225] = "  null
"
  extention DS properties key = ""
  strings[227] = "  -1
"
  useHetrogeneous = ""
  strings[229] = "  false
"
  changable CRI = ""
  strings[231] = "  true
"
  optimizeForGetUseCloseUsage = ""
  strings[233] = "  false
"
  propagateClientIdentityUsingTrustedContext = ""
  strings[235] = "  false
"
  strings[236] = "User Name:"
  strings[237] = "  null
"
  strings[238] = "Password:"
  strings[239] = "  null
"
  strings[240] = "Isolation Level:"
  strings[241] = "  READ COMMITTED (2)
"
  strings[242] = "Catalog:"
  strings[243] = "  null
"
  strings[244] = "Is Read Only?"
  strings[245] = "  null
"
  strings[246] = "Type Map:"
  strings[247] = "  null
"
  strings[248] = "Cursor Holdability:"
  strings[249] = "  DEFAULT CURSOR HOLDABILITY VALUE (0)
"
  strings[250] = "Config ID: 4
"
  strings[251] = "Hash Code:"
  strings[252] = "  4
"
  strings[253] = "Support isolation switching on connection:"
  strings[254] = "  false
"
  strings[255] = "NoEnlistment: "
  strings[256] = "  false
"
  strings[257] = "ShareWithCMPOnly: "
  strings[258] = "  false
"
  strings[259] = "propagateClientIdentityUsingTrustedContext: "
  strings[260] = "  false
"
  strings[261] = "TrustedContext_name:
"
  strings[262] = "null
"
  strings[263] = "TrustedContext_realm:
"
  strings[264] = "null
"
  strings[265] = "TrustedContext_userSecToken:
"
  strings[266] = "
"
  strings[267] = "TrustedContext_originalUser:
"
  strings[268] = "null
"
  gssName = "
"
  strings[270] = "null
"
  gssCredential = "
"
  strings[272] = "null
"
  J2EEName = "
"
  strings[274] = "null
"
  oracle properties = "
"
  strings[276] = "null
"
  strings[277] = "_______________________________________________________________________"
  strings[278] = ""
  strings[279] = "    First Failure Data Capture information for"
  strings[280] = "          com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl@537945"
  strings[281] = "_______________________________________________________________________"
  strings[282] = ""
  strings[283] = "com.ibm.ws.rsadapter.DSConfig@3ec61b"
  strings[284] = "[beginTranForResultSetScrollingAPIs, true, beginTranForVendorAPIs, true, commitOrRollbackOnCleanup, null, connectionSharing, 0, isolationLevel, -1, jndiName, jdbc/db, queryTimeout, null, statementCacheSize, 10, supplementalJDBCTrace, null, syncQueryTimeoutWithTransactionTimeout, false, transactional, true]"
  strings[285] = "[com.ibm.ws.classloading.internal.AppClassLoader@97953, true, ExceptionChecking, com.ibm.websphere.rsadapter.Oracle11gDataStoreHelper@113a6b9, com.ibm.ws.rsadapter.spi.InternalOracle11gDataStoreHelper@14047fa, false, interface javax.sql.DataSource]"
  strings[286] = "{URL=...}"
  strings[287] = "Resource Adapter:"
  strings[288] = "  null
"
  strings[289] = "Database Type:"
  strings[290] = "  null
"
  strings[291] = "Description:"
  strings[292] = "  null
"
  strings[293] = "Log Writer:"
  strings[294] = "  null
"
  strings[295] = "Transaction Branches are set to be Loosely Coupled: "
  strings[296] = "  false
"
  strings[297] = "Counter of fatal connection errors on ManagedConnections created by this MCF:"
  strings[298] = "  0
"
  strings[299] = "Validate existing connections on cleanup after a fatal connection error is detected?"
  strings[300] = "  true
"
  strings[301] = "ResetConnectionByBackendDatabase: "
  strings[302] = "  false
"
  strings[303] = "Backend id checking is: "
  strings[304] = "  true
"
  strings[305] = "JMSOnePhaseOptimization: "
  strings[306] = "  false
"
  strings[307] = "Reauthentication: "
  strings[308] = "  false
"
  strings[309] = "newDBConnectionValidationEnabled: "
  strings[310] = "  false
"
  strings[311] = "connectionRetriesDuringDBFailover: "
  strings[312] = "  100
"
  strings[313] = "connRetryDurationDuringDBFailover: "
  strings[314] = "  3000
"
  strings[315] = "Failover count: "
  strings[316] = "  0
"
  strings[317] = "OracleImplicitConnectionPooling enabled: "
  strings[318] = "  false
"
  strings[319] = ""
  strings[320] = "_______________________________________________________________________"
  strings[321] = ""
  strings[322] = "    First Failure Data Capture information for"
  strings[323] = "          com.ibm.ws.rsadapter.spi.WSRdbDataSource@1358b73"
  strings[324] = "_______________________________________________________________________"
  strings[325] = ""
  strings[326] = "DataSource Implementation Class Name:"
  strings[327] = "  oracle.jdbc.pool.OracleDataSource
"
  strings[328] = "DataSource Name:"
  strings[329] = "  null
"
  strings[330] = "DataStoreHelper:"
  strings[331] = "  com.ibm.websphere.rsadapter.Oracle11gDataStoreHelper@113a6b9
"
  strings[332] = "DataSource properties:"
  strings[333] = "  {URL=...}
"
  strings[334] = "ONE PHASE ENABLED
"
  strings[335] = "Underlying DataSource Object: oracle.jdbc.pool.OracleDataSource@56412e"
  strings[336] = "  oracle.jdbc.pool.OracleDataSource@56412e
"
  strings[337] = "Counter of unique, modified DataSource configurations: 0
"
  strings[338] = "Failover servers list: "
  strings[339] = "  [Ljava.lang.Object;@d1581c
"
 

Can you help me, please?

  • bpaskin
    bpaskin
    2 Posts
    ACCEPTED ANSWER

    Re: Unwrap OracleConnection on Liberty profile DSRA9122E

    ‏2013-11-22T11:00:12Z  in response to melon123

    Hi, The connection is returned to you in the form of the DataSource connection.  Unwrapping is usually used when connecting directly.  Is there anything in particular you want from the unwrapped connection?

    Regards,

    Brian

    • melon123
      melon123
      3 Posts
      ACCEPTED ANSWER

      Re: Unwrap OracleConnection on Liberty profile DSRA9122E

      ‏2013-11-22T12:16:19Z  in response to bpaskin

      I need to call stored proc witch oracle object type parameters. Actualy I changed mapings to use java.sql.Struct but I don't know if I be able do everything only with java.sql.*

      • bpaskin
        bpaskin
        2 Posts
        ACCEPTED ANSWER

        Re: Unwrap OracleConnection on Liberty profile DSRA9122E

        ‏2013-11-22T12:27:20Z  in response to melon123

        Hi, you should not need to unwrap to call a stored procedure with Object parameters.  You need to use CallableStatement or OracleCallableStatement and conn.prepareCall.

        Regards,

        Brian

        • njr11
          njr11
          14 Posts
          ACCEPTED ANSWER

          Re: Unwrap OracleConnection on Liberty profile DSRA9122E

          ‏2013-11-22T15:28:38Z  in response to bpaskin

          Regardless of the reason for wanting to unwrap as oracle.jdbc.OracleConnection, it should have worked.  The configuration looks correct, and an excellent job was done of collecting diagnostic information such that we can see the name of the underlying Oracle connection impl class, oracle.jdbc.driver.T4CConnection.  Given that, and some code like the following running from a standalone Java program with ojdbc6.jar on the classpath,

               LinkedList<Class<?>> interfaces = new LinkedList<Class<?>>();
               for (Class<?> cl = Class.forName("oracle.jdbc.driver.T4CConnection"); cl != null; cl = cl.getSuperclass())
                  interfaces.addAll(Arrays.asList(cl.getInterfaces()));
               Set<String> interfaceNames = new TreeSet<String>();
               for (Class<?> intf; (intf = interfaces.poll()) != null; interfaces.addAll(Arrays.asList(intf.getInterfaces())))
                  interfaceNames.add(intf.getName());
               System.out.println("interfaces: " + interfaceNames); 

          we can see that the following interfaces are implemented by the T4CConnection class:

          interfaces: [java.sql.Connection, java.sql.Wrapper, oracle.jdbc.OracleConnection, oracle.jdbc.internal.ClientDataSupport
          , oracle.jdbc.internal.OracleConnection, oracle.sql.BfileDBAccess, oracle.sql.BlobDBAccess, oracle.sql.ClobDBAccess]

          So unless something else has been done (not shown in the writeup) to confuse the classloader by including copies of ojdbc6.jar or other conflicting oracle jars in different places, this ought to have worked.

          • melon123
            melon123
            3 Posts
            ACCEPTED ANSWER

            Re: Unwrap OracleConnection on Liberty profile DSRA9122E

            ‏2013-11-25T10:40:22Z  in response to njr11

            Thank you very much. Erlier I deleted ojdbc6.jar from aplication and set  <classloader commonLibraryRef="OracleLib"/> but indeed i there was second instance of ojdbc hidden in thirdparty jar, so now everything work fine.