Hi, I�m using a DB2 database. I�ve set the auto commit to false for my JDBC connection. In a for loop I�m preparing a insert statement and inserting the record. When I�m out of the for loop I�m committing the entire transaction. The problem is: I�m inserting the record in the order, say 1, 2, 3, 4 in the for loop. But when I actually look into the table its in the reverse order i.e 4, 3, 2, 1. Is this the default behaviour of JDBC with auto commit set to false? Is there�s any way to change it? Or does it depend on the JDBC driver?? Thanks, - VJ
Is this the default behaviour of JDBC with auto commit set to false?
No, this is the default behaviour of any relational database.
Is there any way to change it?
does it depend on the JDBC driver?
No. As far as I know, for any [O]RDBMS, insert order does not guarantee retrieval order. If you want to retrieve records from your database in a particular order, then use an ORDER BY clause in your SELECT statement. Good Luck, Avi. [ November 19, 2003: Message edited by: Avi Abrami ]
Is this the default behaviour of JDBC with auto commit set to false? Is there�s any way to change it? the default behaviour is specific to the driver. I've worked with some where autocommit defaults to true, and some where it is false. It is always a good idea to set it no matter what the default is for the driver so there isn't any room for assumption errors. Jamie
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com