• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Record is not inserting in MsAccess 2007

 
Shailendra Phadke
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I write the below code to insert record in table .. it is compiling and executing without any error or exception. But my record is not displaying in my table.

Database : Ms-Access 2007

Code :

[/b]Please help me here

Thanks
 
Paul Clapham
Sheriff
Posts: 21558
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that if you close the PreparedStatement and the Connection, then the record should show up in the database.

That's a vague recollection based on years ago, but still you should always close database resources after you finish using them. By the way the JDBC-ODBC driver has been deprecated for a while and doesn't even exist in Java 8. You should really be looking for a supported driver.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:I think that if you close the PreparedStatement and the Connection, then the record should show up in the database.

I agree! And if you are using Java 7 (or later) this can be done very quickly (and easy) using the try-with-resources statement. Here you'll find an example of this statement. And if you are using a Java version prior to Java 7 you should use a finally block to close your resources as illustrated in this post.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic