Multiple Prepared Statements in JSP

Reply

Join Date: Dec 2007
Posts: 65
Reputation: CodeBoy101 is an unknown quantity at this point 
Solved Threads: 0
CodeBoy101's Avatar
CodeBoy101 CodeBoy101 is offline Offline
Junior Poster in Training

Multiple Prepared Statements in JSP

 
0
  #1
Aug 22nd, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,612
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 463
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: Multiple Prepared Statements in JSP

 
0
  #2
Aug 22nd, 2009
  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. ....
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,190
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 483
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Multiple Prepared Statements in JSP

 
-1
  #3
Aug 23rd, 2009
Originally Posted by CodeBoy101 View 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.
Not normal behaviour. If adatapost will not solve it please provide code sample of you using.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 65
Reputation: CodeBoy101 is an unknown quantity at this point 
Solved Threads: 0
CodeBoy101's Avatar
CodeBoy101 CodeBoy101 is offline Offline
Junior Poster in Training

Re: Multiple Prepared Statements in JSP

 
-1
  #4
Aug 24th, 2009
I have a question, what if I was trying to work with more than one table?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,190
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 483
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Multiple Prepared Statements in JSP

 
-1
  #5
Aug 25th, 2009
Originally Posted by CodeBoy101 View Post
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?
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC