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)
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
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
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902