Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and Relational Databases and the fly likes Please help me on this insert statement and pass it to the servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Storm Applied this week in the Other Open Source APIs forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Please help me on this insert statement and pass it to the servlet" Watch "Please help me on this insert statement and pass it to the servlet" New topic
Author

Please help me on this insert statement and pass it to the servlet

RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
Hello ,

I am performing a insert query on to the database in the DAO implemented Layer based on the AJAX request.

i need to inform to the JSP page about the status of the insert result to the jsp page.

int executeUpdate(String sql) , i am thinking in this way , if this returns 1 then its success or its failed operation . Is this correct?





If you want something you never had do something which you had never done
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

From the java.sql.Statement JavaDocs:

Returns:
either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Please help me on this insert statement and pass it to the servlet