w*********y 发帖数: 28 | 1 我想用JDBC往数据库里插入几条记录,但每次执行到executeUpdate(...),程序就死住了
。用catch也找不到error,用PreparedStatement也是同样的问题,用新的Connection,St
atement也不行,反正我能想到的都试过了。----有人说是内存溢出,但是只插入一条记
录,怎么会溢出呢?
请问各位有没有遇到类似这样的问题,如何解决?BTW,我用的是Oracle, 以前从来没问
题的。 |
xt 发帖数: 17532 | 2
了
。用catch也找不到error,用PreparedStatement也是同样的问题,用新的Connection,St
记
问
Did you check your autocommit setting on your java.sql.Connection? If it is
false
you need to explicitly commit or your DB tables will be locked.
【在 w*********y 的大作中提到】 : 我想用JDBC往数据库里插入几条记录,但每次执行到executeUpdate(...),程序就死住了 : 。用catch也找不到error,用PreparedStatement也是同样的问题,用新的Connection,St : atement也不行,反正我能想到的都试过了。----有人说是内存溢出,但是只插入一条记 : 录,怎么会溢出呢? : 请问各位有没有遇到类似这样的问题,如何解决?BTW,我用的是Oracle, 以前从来没问 : 题的。
|
w*********y 发帖数: 28 | 3 多谢指教----不过我的程序里没有用setAutoCommit----我现在估计也许是我插入的reco
rd的一些attributes 跟其他table的attributes 有 refer关系。
住
。用catch也找不到error,用PreparedStatement也是同样的问题,用新的Connection,St
条
没
【在 xt 的大作中提到】 : : 了 : 。用catch也找不到error,用PreparedStatement也是同样的问题,用新的Connection,St : 记 : 问 : Did you check your autocommit setting on your java.sql.Connection? If it is : false : you need to explicitly commit or your DB tables will be locked.
|
xt 发帖数: 17532 | 4
这不能解释deadlock.如果是foreign key有问题会有SQLException.
【在 w*********y 的大作中提到】 : 多谢指教----不过我的程序里没有用setAutoCommit----我现在估计也许是我插入的reco : rd的一些attributes 跟其他table的attributes 有 refer关系。 : : 住 : 。用catch也找不到error,用PreparedStatement也是同样的问题,用新的Connection,St : 条 : 没
|
w*r 发帖数: 2421 | 5 foreign key exception should be caught by sqlexception.
My instinct told me that maybe it is the server side, the
admin does not set proper privileage for you.
【在 w*********y 的大作中提到】 : 多谢指教----不过我的程序里没有用setAutoCommit----我现在估计也许是我插入的reco : rd的一些attributes 跟其他table的attributes 有 refer关系。 : : 住 : 。用catch也找不到error,用PreparedStatement也是同样的问题,用新的Connection,St : 条 : 没
|
y****i 发帖数: 5690 | 6 Why not print out the SQL you are trying to execute and run it directly on the
database using the ODBC connecton username/passwd, then you can prove what
wyr's suggestion fit you or not.
reco
。用catch也找不到error,用PreparedStatement也是同样的问题,用新的Connection,St
is
【在 w*r 的大作中提到】 : foreign key exception should be caught by sqlexception. : My instinct told me that maybe it is the server side, the : admin does not set proper privileage for you.
|
w*r 发帖数: 2421 | 7 right right.. .this is the basic testing method.. sqlplus will give you
a direct answer...
【在 y****i 的大作中提到】 : Why not print out the SQL you are trying to execute and run it directly on the : database using the ODBC connecton username/passwd, then you can prove what : wyr's suggestion fit you or not. : : reco : 。用catch也找不到error,用PreparedStatement也是同样的问题,用新的Connection,St : is
|