permaculture playing cards
The moose likes JDBC and Relational Databases and the fly likes What is the result of Prepared Statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "What is the result of Prepared Statement" Watch "What is the result of Prepared Statement" New topic

What is the result of Prepared Statement

Pradeeep Sharma
Ranch Hand

Joined: Dec 04, 2008
Posts: 32
I have created a registration form in JSP, which takes values from user and insert it into database. In this form i am using PreparedStatement interface to execute the querry. now i want that if user fills this form and press submit button and if putting values in database got failed, than user should informed that registration failed try again. For that could any one tell me that what will be the value of 'i' after perfoming :


if registration failed.
Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
Hi Pradeeep,
Normally if the insert or update fails you will get a SQL Exception which you can catch and hadle it appropriately. If everything goes fine and still the row was not update you will get a return value of "0" for the method.

Please check the java documentation for more details.

I agree. Here's the link:
subject: What is the result of Prepared Statement
It's not a secret anymore!