954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Multiple Prepared Statements in JSP

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.

CodeBoy101
Junior Poster in Training
71 posts since Dec 2007
Reputation Points: 8
Solved Threads: 0
 
....
      String query = "insert into table(stringcol, numcol) values(?, ?)";
      pstmt = conn.prepareStatement(query);
      pstmt.setString(1, "A");
      pstmt.setInt(2, 10);
      pstmt.addBatch();

      pstmt.setString(1, "B");
      pstmt.setInt(2, 2);
      pstmt.addBatch();

      int[] updateCounts = pstmt.executeBatch();
      checkUpdateCounts(updateCounts);
      conn.commit();
      ....
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

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.

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

I have a question, what if I was trying to work with more than one table?

CodeBoy101
Junior Poster in Training
71 posts since Dec 2007
Reputation Points: 8
Solved Threads: 0
 
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?

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You