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_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.

.



Relevant Pages

  • Re: Oneys Book, HandleQueryStop(): Why is there no race condition?
    ... The simplest approach is to just deny the query. ... allow the query but leave the system vulnerable as the race condition cannot ... >> If there is need to stop the device, the driver should be ... >>> Conexant Systems, Inc. ...
    (microsoft.public.development.device.drivers)
  • RE: Calculating the cumulative totals for an ending result
    ... Your query fields do not correspond the sample data. ... FROM Odometer INNER JOIN Movement ON Odometer.Unit = Movement.Unit ... "KARL DEWEY" wrote: ... 'Business KM and Personal KM' per unit# with the driver for the month. ...
    (microsoft.public.access.queries)
  • Re: Order in bind variable for PreparedStatement in Java
    ... > I have a critical problem with a prepared query and bind variable in Java. ... > I am confused because it seems that the jdbc driver bind the variable ... > bind variables. ... > My Jdbc informix driver is 2.21.JC5 ...
    (comp.lang.java.databases)
  • Re: Object oriented method is inefficient with database calling
    ... amount of records a database query to the table t_car returns. ... record and leave the Driver property in the Car object aside. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Oracle parameter problem with OraOLEDB driver
    ... "Mick Board" wrote in message ... I am using this driver rather than the ... > I have a query which contains parameters, one of which is an integer. ... > query has its datasource value set to a datasource as it is the detail ...
    (borland.public.delphi.database.ado)