Skip to Content
0
Former Member
Aug 02, 2006 at 09:13 AM

Sharing JDBC connection between web service methods

40 Views

Hi

I have problem with sharing JDBC connection between web service methods.

In one method I get JDBC connection from data source, set auto-commit

mode to <i>false</i>, call UPDATE statement and store connection object into custom

session object. In next method I want to use this opened connection,

but SQL statement failed with exception:

com.sap.engine.services.dbpool.exceptions.BaseSQLException: Connection is invalid.

at com.sap.engine.services.dbpool.cci.ConnectionHandle.checkIfInvalid(ConnectionHandle.java:598)

at com.sap.engine.services.dbpool.cci.ConnectionHandle.checkIfValid(ConnectionHandle.java:584)

at com.sap.engine.services.dbpool.cci.ConnectionHandle.prepareCall(ConnectionHandle.java:96)

...

In application server trace log I found yet another exception:

UNSAFE THREAD CONNECTION USAGE DETECTED. The Connection com.sap.engine.services.dbpool.cci.ConnectionHandle@6afa82 has been acquired in thread HTTP Worker [2] and used in thread HTTP Worker [0]. dumpStack(): java.lang.Exception: Tracing the call:

at com.sap.engine.services.dbpool.cci.ConnectionHandle.checkIfThreadSafe(ConnectionHandle.java:609)

at com.sap.engine.services.dbpool.cci.ConnectionHandle.checkIfValid(ConnectionHandle.java:582)

at com.sap.engine.services.dbpool.cci.ConnectionHandle.prepareCall(ConnectionHandle.java:96)

...

I use SAP Netweaver J2EE Preview (2007).

Data source is defined as JDBC-1.x.

JDBC driver is from Oracle 10.2.0.1.

Web service works correctly on Sun Application Server and Oracle OC4J.

Why JDBC connection is invalid, when I does not call close() method?

Can any one help me to solve this problem?

Thanks

VP