I have the following problem.
1) Query to get the total number of entries.
2) ?
3) Query and get rows 350,000 - 350,500 of 56,000,000 entries.
How can I ignore a different transactions inserts/deletes at step 2?
-
jdbc transactions???? (3 messages)
- Posted by: Matthew Wilson
- Posted on: March 29 2006 12:45 EST
Threaded Messages (3)
- jdbc transactions???? by Einar Valen on March 30 2006 03:15 EST
- jdbc transactions???? by Bob Armour on March 30 2006 08:34 EST
- jdbc transactions???? by Poetic Justice on April 20 2006 12:23 EDT
-
jdbc transactions????[ Go to top ]
- Posted by: Einar Valen
- Posted on: March 30 2006 03:15 EST
- in response to Matthew Wilson
To count the number of entries in a table:
select count(*) from mytable
Add a where clause to count the number of rows in a selection:
select count(*) from mytable where surname='Smith'
To get a range:
select * from mytable where myid between 350000 and 350500
Check out this site: http://www.w3schools.com/sql/ -
jdbc transactions????[ Go to top ]
- Posted by: Bob Armour
- Posted on: March 30 2006 08:34 EST
- in response to Einar Valen
The usual way to do this is kind of thing is...
Obtain connection
Call connection.setAutoCommit(false)
try{
operation #1
operation #2
operation #3
connection.commit();
}
catch{SomeSortOfException e){
connection.rollback();
}
finally{
connection.close();
}
Hope this makes sense.
Bob -
jdbc transactions????[ Go to top ]
- Posted by: Poetic Justice
- Posted on: April 20 2006 12:23 EDT
- in response to Matthew Wilson
Why use JDBC? In the long term of things you should really look to using a persistance layer for your application. I would recomend Hibernate because it has a low learning curve. Using regular JDBC in your application with the reall cool persistence tools out there doesn't make much sense to me.