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!
Joined: Oct 17, 2001
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.