This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 在Java中怎么锁定Oracle一张表不让其它人对它进行更新?还是要用lock?或是建Statement或是PreparedStament时可以设置?
能对一个sequence锁定么?暂时不让人使用
谢谢
-rabbitbug(兔八哥);
2003-10-13
{106}
(#1410865@0)
-
锁不锁表和JAVA没有直接关系. 如果你运行UPDATE语句或STORE PROCEDURE中有UPDATE, 而没有COMMIT, 就自动锁表. 另外SEQUENCE不能锁. 可以通过改变ORACLE设置变LOCK.
-badegg(badegg);
2003-10-13
(#1411198@0)
-
A good process never locks a table at table level because this could cause a DEAD lock. In terms of sequence...You cannot lock a sequence. You could read the current value into a varable to retrieve in the future or create a sequence without sharing it with others
-handd(大熊猫®);
2003-10-14
{153}
(#1411745@0)
-
Oracle文档这样说Problem Description
-------------------
You want to hold an explictlock on a table within SQL or PL/SQL until you issue a commit or rollback.
Solution Description
--------------------
Use the LOCK TABLE statement. The syntax is as follows: LOCK TABLE <table_reference> IN <lock_mode> MODE <NOWAIT>;
Example: LOCK TABLE emp IN ROW SHARE MODE NOWAIT;
Explanation
-----------
This statement allows you to lock an entire database table in a specified lock mode.
-whatwhenwherewhy(一生何求);
2003-10-19
{503}
(#1421001@0)