aspose file tools*
The moose likes JDBC and the fly likes 5 INSERT but only 4 in my access table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "5 INSERT but only 4 in my access table" Watch "5 INSERT but only 4 in my access table" New topic
Author

5 INSERT but only 4 in my access table

Younes Essouabni
Ranch Hand

Joined: Jan 13, 2002
Posts: 479
This is a simple ex from the JAVA TUTORIAL
But with my access Database I have only four rows inserted and I should have 5.
In fact it's always the last that is missing.
Any Idea??,
Here is the code!

I must have missed something!
Can anyone help me?
[ February 28, 2002: Message edited by: Younes Essouabni ]

Younes
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
Younes Essouabni
Ranch Hand

Joined: Jan 13, 2002
Posts: 479
If I add another executeUpdate
like this:
stmt.executeUpdate("UPDATE COFFEES SET TOTAL=1000 WHERE COF_NAME LIKE 'Colombian'");
I will have my 5 elements but not the update of TOTAL?
Any suggestions?
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

This is a common Problem with jdbc ODBC bridge when connecting to Access. For all inserts to take effect, do a dummy select on the table you inserted into after you've completed your inserts. For some reason this gives the database a smack in the face and causes the last entry to be committed.

Jamie
[ February 28, 2002: Message edited by: Jamie Robertson ]
Younes Essouabni
Ranch Hand

Joined: Jan 13, 2002
Posts: 479
Thx for your help!!!
 
 
subject: 5 INSERT but only 4 in my access table