Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.java.* > Newsgroup comp.lang.java.databases

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2006, 07:03 PM
msj121
Guest
 
Posts: n/a
Default JDBC Keep Query open for checking

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_COM MIT);
Statement stmt =
con.createStatement(ResultSet.TYPE_SCROLL_INSENSIT IVE,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.

Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 06-23-2006, 07:38 PM
msj121
Guest
 
Posts: n/a
Default Re: JDBC Keep Query open for checking


Update:

Somehow the last number decrements when another program issues the
delete (As400 Client program provided by IBM), BUT I cannot see the
last number INCREMENT when a row is inserted...I think I have tried
every transaction isolation level too.

Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: JDBC call vs. ODBC David L Cassell Newsgroup comp.soft-sys.sas 1 11-15-2006 02:14 PM
Data Programming question VV Newsgroup comp.soft-sys.sas 0 11-14-2006 10:26 PM
Re: My query involves Cartesian product Sigurd Hermansen Newsgroup comp.soft-sys.sas 0 06-23-2006 09:17 PM
appdev studio error........ Can I give a CREATE TABLE AS query m k Newsgroup comp.soft-sys.sas 0 02-10-2005 04:26 PM



All times are GMT. The time now is 07:58 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.