aspose file tools*
The moose likes JDBC 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
Bookmark "problem in inserting data" Watch "problem in inserting data" New topic
Author

problem in inserting data

aparna rudra
Greenhorn

Joined: Apr 06, 2004
Posts: 14
hiii

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:
aparna
enter the employee salary:
3000
number of rows inserted:1

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

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.

Dave
 
jQuery in Action, 2nd edition
 
subject: problem in inserting data