PreparedStatement不起作用 [英] PreparedStatement is not working
本文介绍了PreparedStatement不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我必须在表格中插入多行。我使用addBatch和executeBatch插入行
。
每行有5列。每行四列包含
除最后一列之外的相同值。
所以我使用for循环来设置最后一列值。
我正在使用JDK1.5,DB2和WAS6.1。我的连接正常,setAutoCommit设置为false。
Hi
I have to insert multiple rows into a Table. I am inserting rows
using addBatch and executeBatch.
Each row has 5 columns. Four columns of each row contain
same value except last column.
So I am using for loop to set the last column value.
I am using JDK1.5, DB2 and WAS6.1. My connection is OK and setAutoCommit sets as false.
展开 | 选择 | Wrap | 行号
推荐答案
@kokababu
你在另一个会话中检查它。
每当你打开一个连接然后打开一个数据库会话,如果 setAutoComit(false)完成后,修改后的数据仅反映到您执行操作的那个会话操作;否则修改后的数据会反映在所有数据库会话中如果您签入同一会话,则必须获取修改后的数据。
@kokababu
You are checking it in another session.
Whenever you open a connection then a database session opens up, if the setAutoComit(false) is done then the modified data reflected to that session only where you did the operations; otherwise the modified data reflected across all database session. If you check in same session then you must get the modified data.
您好,
谢谢
我设置setAutoComit为true从我的代码中删除了commit()。
但是,仍然没有数据插入到表中。我很困惑。
Hi,
Thank you
I set setAutoComit true and removed commit() from my code.
But still, no data is inserted into the table. I am very confused.
当您打印第15行中获得的''计数器'阵列时,您看到了什么?
亲切的问候,
Jos
What do you see when you print the ''counter'' array obtained in line #15?
kind regards,
Jos
这篇关于PreparedStatement不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文