File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updating a record

 
lucky soni
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Not able to insert into access database....getiing a msg Row is added and .ldb file is getting created but the database has no new row added.
but able to query the database and get results
 
Ashwini Kashyap
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For inserting or manipulating with the database(i.e. for DML commands), you should use PreparedStatement instead of simple Statement.
Statement should be used normally for DDL commands like select, delete and so on.

Example:
PreparedStatement pst= con.prepareStatement(sql);

Also, catch SQLException and close the connection and PreparedStatement in the finally block(*very important*).
You should always close the connection.

Thanks,
Ashwini Kashyap | www.infocepts.com
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic