wood burning stoves 2.0*
The moose likes JDBC and the fly likes Connection Pooling Problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Pooling Problem?" Watch "Connection Pooling Problem?" New topic
Author

Connection Pooling Problem?

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
Hello,

I've written a standalone Java application (first) to make sure I could insert a new blob into an Oracle Database via JDBC. That works fine.

There are several steps to doing this including:

1. Doing an insert for the EMPTY_BLOB() (locator)

2. Then doing other stuff in that session, like getting the primary key just entered via the sequence.

The problem is that in our "actual" application, with connection pooling, I can't get the Oracle "currval" once I do the insert (step 1) with the sequence's "nextVal".

The error I get is: "sequence is not yet defined in this session"

Yet, in the standalone Java application it works fine. Same JDBC connection, same database, etc.. The only difference I can determine is the real application has connection pooling.

Any ideas how to resolve this issue? Perhaps I should override the application's DAO methods to use a single connection object for these steps?

I really appreciate them in advance!

M
Shailesh Kini
Ranch Hand

Joined: Oct 17, 2001
Posts: 153
Mike,

Are you calling getConnection for each of the steps you mentioned below or just one time before executing all these steps. The difference being, when you call getConnection on your datasource it could return a different instance of connection everytime.

In my opinion the possible resolution for this issue would be to call getConnection once and execute all these steps with that reference and closing it after you are done.


Shailesh Kini.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection Pooling Problem?
 
Similar Threads
JDBC start/stop database needed
Oracle JDBC Connectivity problem
WebSphere community edition 1.0.1.2 Database Pools connection problem
JDBC Connection Pooling Framework
can the data fetching time be extended?