Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in inserting data

 
aparna rudra
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic