aspose file tools
The moose likes JDBC and the fly likes How to check whether data is inserted or not in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "How to check whether data is inserted or not in Java" Watch "How to check whether data is inserted or not in Java" New topic
Author

How to check whether data is inserted or not in Java

Deo Sharma
Greenhorn

Joined: Apr 14, 2012
Posts: 12
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

Joined: Oct 21, 2008
Posts: 1098

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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to check whether data is inserted or not in Java
 
Similar Threads
try, catch, finally and return
Full stack testing of java web application with selenium
what is retBoolean
How to manage CMP field with Boolean type????
How to find insert/update/delete queries are successful in PreparedStatements[solved]