File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Failed to insert a record into MSAcess Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Failed to insert a record into MSAcess" Watch "Failed to insert a record into MSAcess" New topic
Author

Failed to insert a record into MSAcess

arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
Hello,
I am trying with the following code to insert a record into the MS Access database...It prints me on system that it has inserted a record but it never did same...Am I doing something wrong or there is some other problem?
I am using following:
1. Windows 2000
2. MS Access 2000
3. JDK 1.3.0 ( also tried with 1.4.0)
To Connect with database
*************************

To insert a record(tried using Preapared and Simple Statement:
*******************

regards,
Arun
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

If you ran a search in the JDBC forum, you'd find that this is a common problem with the JDBC-ODBC bridge.
Solution: either make sure you close the connection, set autocommit(true) before hand, or do a dummy read (ie a search that you don't care about the results of) after the insert or update.
Dave
sim sim
Ranch Hand

Joined: Jun 05, 2002
Posts: 55
the inserted row reflects in the MS Access database only when u close the connection.
Sim Sim.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

...which is what I said.
sim sim
Ranch Hand

Joined: Jun 05, 2002
Posts: 55
OOPS...I did not notice...Sorry boss
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Failed to insert a record into MSAcess