mysqlÇøû¸ßÊÖ - MS-SQL Server / »ù´¡Àà
ÎÒ¾õµÃmysqlºÍsqlserverÓй²Í¬µÄµØ·½£º
ÓиöÎÊÌâÊǹØÓÚ±íµÄËøÎÊÌ⣺
½ø³ÌA ½ø³ÌB
select * from user where id in lock share mode£¨¹²ÏíËø)
update user set name='55' where id=1£¨´ËʱËøסµÈ´ýA£©
update user set name='66' where id=1£¨Õâ¸öʱºò»á³öÏÖËÀËø)
¸üгɹ¦
Èç¹û»»³Éɾ³ýµÄ»°¾Í²»»á³öÏÖËÀËø״̬£¬B»áµÈ´ýAÌá½»ºóɾ³ý
Èç¹û½«select»»ÎªÅÅËûËøµÄ»°B»áµÈ´ýAÌá½»ºó¸üÐÂ
ÊéÖнâÊÍÊÇBÓÉÓÚÎÞ·¨»ñÈ¡¹²ÏíËøËùÒÔ·ÅÈë¶ÓÁУ¬A´ËʱupdateÓë¶ÓÁеÄBµÄupdate³åÍ»Ôì³ÉËÀËø£¬
ÎÒÈÏΪµÄÊÇBÓ¦¸ÃÔÚAÌá½»ºó²Å½øÐиüвÙ×÷£¬´ËʱΪʲô²¢Ã»ÓÐÌá½»¾Í»á·¢Éú³åÍ»ÄØ£¿¶øselectÉèΪÅÅËûËø¾Í²»»á
¹²ÏíËøÓëÅÅËûËø»¹ÓÐʲôÔÀíÄØ£¿Ð»Ð»
Èç¹ûÊÇsql server,Ôò²Î¿¼ÏÂÃæµÄһЩÎÄÕÂ.
SQL code:
1 ÈçºÎËøÒ»¸ö±íµÄijһÐÐ
A Á¬½ÓÖÐÖ´ÐÐ
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ
begin tran
select * from tablename with (rowlock) where id=3
waitfor delay '00:00:05'
commit tran
BÁ¬½ÓÖÐÈç¹ûÖ´ÐÐ
update tablename set colname='10' where id=3 --ÔòÒªµÈ´ý5Ãë
update tablename set colname='10' where id<>3 --¿ÉÁ¢¼´Ö´ÐÐ
2 Ëø¶¨Êý¾Ý¿âµÄÒ»¸ö±í
Ïà¹ØÎÊ´ð£º
ÎÒÓжà¸ö±íA B C ½á¹¹ÊÇÒ»ÑùµÄ£¬¶¼ÓÐ2¸ö×Ö¶ÎnameºÍcontent,ÎÒÒªËÑË÷ËùÒÔ±íËùÓÐ×Ö¶ÎÖаüº¬¡°Öйú¡±µÄÄÚÈÝ Õâ¸öSQLÓï¾äÔõôд
ÈçºÎ½«¶à¸ö±íµÄ²éѯ½á¹ûÁ¬³ÉÒ»¸ö±í Õâ¸öSQLÓï¾äÔõôд ±íµÄ½á¹¹ÊÇÒ»ÑùµÄ
ÀýÈç£ ......
½ñÌì×öÁËÒ»¸ö´æ´¢¹ý³Ì »·¾³ÊÇSQL2000Êý¾Ý¿â
´óÖÂÈçÏÂ
½¨Á¢ÁÙʱ±í
¶¨ÒåÔ±¹¤Óαê
Ñ»·Ô±¹¤£¨ÊôÓÚ1¸ö¹«Ë¾)
......
ÎÒÏë²éѯ³öÿÌìÊý¾ÝµÄ×î´óµÄÒ»¸öÖµ¡£±íµÄ¸ñʽÈçÏÂ
±íÃû: hisdata
×ֶΠ±àºÅ Öµ ״̬ ʱ¼ä
Id value state dattime
101 32.3 0 ......
ÎÒÊǸöÐÂÊÖ£¬Íû¸ßÊÖ½â´ð
ÎÒÏÖÔÚÒѾ°²×°ÁËmysql£¬Ò²ÓÐmysqlµÄjdbc¡£µ«ÎÒÔõôÅäÖú󣬲ÅÄÜÔÚMyEclipseÀï²Ù×÷mysqlÄØ£¿Çë¸ßÊÖ˵Ïêϸµã
´ò¿ªMyeclipse----window---open perspective---MyEclipse database explorer-- ......