JDBC Keep Query open for checking
- From: "msj121" <m_sj121@xxxxxxxxxxx>
- Date: 23 Jun 2006 12:03:41 -0700
Hi,
I am now just getting into the JDBC api quite in depth.
I want to be able to see when a new row is inserted into the a table.
My method so far was "simple". I used "INSENSITIVE" ResultSets since I
understand "Sensitive" ResultSets are cached to the computer (I want my
ResultSet to be OPEN on the server to check it, and then sleep). To
prevent TONS of overhead I do NOT want to issue the query again (even
though this is a simple solution). I realized I could likely make a
stored query, but if I can do it directly in the result set that would
be Perfect!
I simply keep going through the resulset(".next()") until I get to a
"Zero" row, storing the one JUST previous as the final row.
Connection con =
DriverManager.getConnection(URL,user_Name,password);
con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
con.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT);
Statement stmt =
con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
I have tried OODLES of "workarounds" -- and have searched these forums
for prolly atleast 2 hrs. It sounds like there is a way to use "FOR
UPDATE" in the Query to get a lock, but then I need to make another
query to commit...is this more useful?
btw, the driver is: "com.ibm.as400.access.AS400JDBCDriver"
Would this work, if I could get "COM.ibm.db2.jdbc.app.DB2Driver" driver
working?
Thank you so much to ANYONE for helping in any way they can, my mind is
rattled by this one.
.
- Follow-Ups:
- Re: JDBC Keep Query open for checking
- From: msj121
- Re: JDBC Keep Query open for checking
- Prev by Date: problem with JBoss and interclient -> Cannot transliterate ...
- Next by Date: Re: JDBC Keep Query open for checking
- Previous by thread: problem with JBoss and interclient -> Cannot transliterate ...
- Next by thread: Re: JDBC Keep Query open for checking
- Index(es):
Relevant Pages
|