Two Laptop Bag*
The moose likes JDBC and the fly likes Updates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Updates" Watch "Updates" New topic
Author

Updates

Tapan Parikh
Greenhorn

Joined: Jun 28, 2001
Posts: 26
Im having some problems using the JDBCODBC Bridge to connect to Access 97 on Win 98.
The problem is that some Updates dont seem to commit to the DB. The statement executes fine, no exceptions or anything, it even produces and exception when the statement is invalid (like when it violates a prim key or foreign key constraint). But the result never shows up in the DB.
Any ideas? conn.commit() doesnt work...
Also JDBCODBC seems to fire a native error on conn.close()...
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
When a connection is created, it is in auto-commit mode. This means that each individual SQL statement is treated as a transaction and will be automatically committed right after it is executed.
The last thing you can try is disable auto-commit mode and then commit the transaction. Later you can enable the auto commit mode.
con.setAutoCommit(false);
// your
// SQL statements
// will go here
con.commit();
con.setAutoCommit(true);


Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Updates
 
Similar Threads
MSAccess and JDBC
Spring Persistence with Hibernate: Caching Strategies
Write to DB immediately before cnn.close()
getting Primary key when inserting
Hashtable vs. HashMap