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 inserting 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 inserting data" Watch "problem in inserting data" New topic

problem in inserting data

aparna rudra

Joined: Apr 06, 2004
Posts: 14

i have a problem here, which couldnt be solved. i have written a JDBC program, i am trying to insert data into a table. when i compile the program, i get the output. it also gives me the number of rows inserted too. but when i open my data base i couldnt see any data inserted, i dont understand where the data is getting stored.

when i do the selection process data is being retreived. i do not have any problem for selection. why isnt this not working with insertion? is there any problem with data base? i am using MSACCESS.

HERE IS my program with insertion. please anyone help me.

thank u

output: enter the employee name:
enter the employee salary:
number of rows inserted:1

[edited to add UBB code tags]
[ November 03, 2004: Message edited by: Jeanne Boyarsky ]
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Firstly: jdbc:odbc and access are not good for real applications and you're better off using a real database from the start.

Secondly: this is a known error in the jdbc:odbc bridge. The easiest solution is to set autoCommit(true) or do a dummy select (eg select a from table where id=1) straight after the insert. You can get more information by searching this forum, but basically the query gets cached so you need to do something to make sure it gets flushed.

I agree. Here's the link:
subject: problem in inserting data
It's not a secret anymore!