File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to check whether data is inserted or not in Java

 
Deo Sharma
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I m trying to insert data in my Ms-access database using Java. Actually my data is inserted but how to check through code that whether data is inserted or not. What type of value is return by java insertion statement. I m not able to track this as it throw exception and every time my boolean value became false also when data is inserted because it throw exception even when my data got inserted. I want to return true when my data is inserted and want to return false when any exception is occur. Can you tell me which statement to use and how.
 
Wendy Gibbons
Bartender
Posts: 1107
Eclipse IDE Oracle VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you are using a prepared statement (which is highly recommended use prepared statements) the executeUpdate statement returns the number of rows inserted.

but if you are getting an exception i would worry about that first.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic