当前位置: 动力学知识库 > 问答 > 编程问答 >

mysql - How to retrive all the queries added to a statement using addBatch() in java

问题描述:

I think this is a very basic question. I would like to get all the queries added to a java.sql.Statement object using addBatch() function. Consider the below code

Statement s =con.createStatement();

s.addBatch("insert into hib_user_details (first_name, last_name, dob, email, user_id) values ('vivek', 'vivek', '2014-02-27', 'email', 26)");

s.addBatch("update hib_user_details set first_name='2'");

s.addBatch("delete from hib_user_details where user_id=14");

int[] updateCount = s.executeBatch();

I would like to get the list of the three queries added above. Is there any way to get it using statement object. I surfed all the methods of Statement from the javadoc and end up with nothing. Kindly clarify. Thanks a lot.

分享给朋友:
您可能感兴趣的文章:
随机阅读: