File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes problem in insertion of data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "problem in insertion of data" Watch "problem in insertion of data" New topic

problem in insertion of data

Malik Tahir

Joined: Sep 29, 2001
Posts: 18
I m facing problem when i insert data into the MS Access through JDBC. I m using jdk1.4 Beta and have got the results using next method. Even though i m passing the parameters ResultSet.TYPE_SCROLL_SENSITIVE, CONCUR_UPDATABLE in createStatement method.
Can anyone tell me about what i m missing.
Thanks in Advance
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

If you are connecting to an Access database you are probably using the JDBC-ODBC bridge (type 1 driver) so all those settings are ignored. Or rather, they are not supported by that driver.
There is a problem where inserts and updates don't go through until the next operation is performed on the connection.
Try one of these:
* if you need to, insert another row.
* or you can perform a dummy select like select id from table
* I usually set autoCommit(true) and have no problems. I don't usually recommend doing this, but if it's Access, who cares!
Malik Tahir

Joined: Sep 29, 2001
Posts: 18
Thanks David for your valueable tip.
Younes Essouabni
Ranch Hand

Joined: Jan 13, 2002
Posts: 479
I also have some problems with Access.
I will try the setAutocommit(true), but I think that it is the default behaviour. So, I'm not sure that it will change anything.

By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
Laura Brown

Joined: Feb 04, 2003
Posts: 2
There is a problem with the updates of existing records that can be solved using a dummy query (query something small and don't to do anything with the results). But from my experience and a couple other posts I've found (with massive searching) there is also a bug in the odbc driver for Access that comes with Windows 2000 service pack 2 (not sure if it's in the earlier sp's or not). I solved my problem by installing sp3. I believe you can also download the mdac package from microsoft at
and get the driver from it. I don't know if this will interfere with anything else though.
I agree. Here's the link:
subject: problem in insertion of data