Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDBC connection leaks

Mr OracleApr 7 2018 — edited Apr 15 2018

I am using JDev 12.2.1.3 with JDK 1.8 on Windows 10

Integrated Weblogic (12.2.1.3) for testing.

I have javaIMPL classes in my application modules and have a need for jdbc connections in classes I use.

(public class DalaDalaAMImpl extends ApplicationModuleImpl implements DalaDalaAM)

I have been using the DBConnection class to get the connection:

DBTransaction txn = getDBTransaction();

ClassNeedingConnection(txn);

   txn.createStatement(0).executeUpdate(sql);

or most common

  DBSequence trId = getNextSequenceNumber("A_SEQ", txn);

where

  SequenceImpl sequence = new SequenceImpl(sequenceName, txn);

I am using JINI data sources.

I am having issues with leaking jdbc connections to the point where the application becomes unstable.

Because the DBTransaction is the base connection - I cannot close without creating errors (I already close all the resources I use).

I use the Task Flow Return in  the application, but this does not appear to close the transactions.

When I shutdown the server - it can have as many as 16 resources still in use.

This is an upgrade to an older system (11g) which did not have any issues but I used jdbc connections directly (creating a nightmare if something failed)

I moved all the business logic into the server side and wanted to encapsulate everything in a singe transaction.

Is there a better (correct) way yo do this? and maintain the transaction integrity?

or do I need to go back to the jdbc connection (autocommit = false) and just include a commit/rollback in the finally clause?

(this seems like a bad approach - better to get the transaction connection from the Application module and let the transaction manager handle it)

Documentation is not really clear - I get the impression that using the JINI connection disables the transaction control for the application module.

Any suggestions or solutions? would be appreciated.

This would seem to be a very common need for complex applications.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2018
Added on Apr 7 2018
4 comments
561 views