This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes problem in insertion of data Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "problem in insertion of data" Watch "problem in insertion of data" New topic
Author

problem in insertion of data

Malik Tahir
Greenhorn

Joined: Sep 29, 2001
Posts: 18
Hi,
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
Rancher

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!
Dave
Malik Tahir
Greenhorn

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.


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

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
http://www.microsoft.com/data/download.htm
and get the driver from it. I don't know if this will interfere with anything else though.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: problem in insertion of data
 
Similar Threads
JTable help needed.
Compilation Problem in CHAP3 example
error in retrieving from file.
How to add items in the dropdown list dynamically on radio button selection
Exporting to excel