943,918 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 1235
  • JSP RSS
Aug 22nd, 2009
0

Multiple Prepared Statements in JSP

Expand Post »
Hello all, I've been working on a project where I wish to retrieve two sets of information from a MySQL database using two prepared statements. When I try to do this I get a blank screen, but the first query is successfull executed. Any suggestion would be greatly appreciated.

Thanks.
Similar Threads
Reputation Points: 8
Solved Threads: 0
Junior Poster in Training
CodeBoy101 is offline Offline
71 posts
since Dec 2007
Aug 22nd, 2009
0

Re: Multiple Prepared Statements in JSP

jsp Syntax (Toggle Plain Text)
  1. ....
  2. String query = "insert into table(stringcol, numcol) values(?, ?)";
  3. pstmt = conn.prepareStatement(query);
  4. pstmt.setString(1, "A");
  5. pstmt.setInt(2, 10);
  6. pstmt.addBatch();
  7.  
  8. pstmt.setString(1, "B");
  9. pstmt.setInt(2, 2);
  10. pstmt.addBatch();
  11.  
  12. int[] updateCounts = pstmt.executeBatch();
  13. checkUpdateCounts(updateCounts);
  14. conn.commit();
  15. ....
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Aug 23rd, 2009
-1

Re: Multiple Prepared Statements in JSP

Click to Expand / Collapse  Quote originally posted by CodeBoy101 ...
Hello all, I've been working on a project where I wish to retrieve two sets of information from a MySQL database using two prepared statements. When I try to do this I get a blank screen, but the first query is successfull executed. Any suggestion would be greatly appreciated.

Thanks.
Not normal behaviour. If adatapost will not solve it please provide code sample of you using.
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Aug 24th, 2009
-1

Re: Multiple Prepared Statements in JSP

I have a question, what if I was trying to work with more than one table?
Reputation Points: 8
Solved Threads: 0
Junior Poster in Training
CodeBoy101 is offline Offline
71 posts
since Dec 2007
Aug 25th, 2009
-1

Re: Multiple Prepared Statements in JSP

Click to Expand / Collapse  Quote originally posted by CodeBoy101 ...
I have a question, what if I was trying to work with more than one table?
It makes no difference to us...

Now, are you gone answer previous question about code you using?
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: How to create web proxy through jsp
Next Thread in JSP Forum Timeline: Please help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC