MysqlËø»úÖÆ
mysqlËø»úÖÆ
mysqlÖÐ¶Ô±í¼¶µÄ´æ´¢ÒýÇæÀ´ËµÊÇÊÍ·ÅËÀËøµÄ£¬±ÜÃâËÀËø¿ÉÒÔÕâÑù×öµ½:ÔÚÈκβéѯ֮ǰÏÈÇëÇóËø£¬²¢ÇÒ°´ÕÕÇëÇóµÄ˳ÐòËø±í¡£
MysqlÖÐÓÃÓÚwrite(д)µÄ±íËøµÄʵÏÖ»úÖÆÈçÏ£º
Èç¹û±íûÓмÓËø£¬ÄÇô¾Í¼ÓÒ»¸öдËø¡£·ñÔòµÄ»°£¬½«ÇëÇó·Åµ½Ð´Ëø¶ÓÁÐÖС£
mysqlÖÐÓÃÓÚread(¶Á)µÄ±íËøµÄʵÏÖ»úÖÆÈçÏ£º
Èç¹û±íûÓмÓËø£¬ÄÇô¾Í¼ÓÒ»¸ö¶ÁËø¡£·ñÔòµÄ»°£¬½«ÇëÇó·Åµ½¶ÁËø¶ÓÁÐÖС£
±È·½ËµÒ»¿ªÊ¼Ã»ÓÐËø£¬ÎÒ¶ÁÊý¾Ý£¬Õâʱ¾Í¼ÓÒ»¸ö¶ÁËø£¬ÕâʱÈç¹ûÀ´¸öд²Ù×÷£¬ÄÇô¾Í°Ñд²Ù×÷ÇëÇó·Åµ½Ð´Ëø¶ÓÁÐÖС£
±È·½ËµÒ»¿ªÊ¼Ã»ÓÐËø£¬ÎÒд²Ù×÷£¬Õâʱ¾Í¼ÓÒ»¸öдËø£¬ÕâʱÈç¹ûÀ´¸ö¶Á²Ù×÷£¬ÄÇô¾Í°Ñ¶Á²Ù×÷ÇëÇó·Åµ½¶ÁËø¶ÓÁÐÖС£
µ±ËøÊͷźó£¬Ð´Ëø¶ÓÁÐÖеÄÏ߳̿ÉÒÔÓÃÕâ¸öËø×ÊÔ´£¬È»ºó²ÅÂÖµ½¶ÁËø¶ÓÁÐÖеÄÏ̡߳£
Õâ¾ÍÊÇ˵£¬Èç¹û±íÀïÓкܶà¸üвÙ×÷µÄ»°£¬ÄÇôselect±ØÐëµÈµ½ËùÓеĸüж¼Íê³ÉÁËÖ®ºó²ÅÄÜ¿ªÊ¼¡£
ÈÃselectËٶȾ¡Á¿¿ì£¬Õâ¿ÉÄÜÐèÒª´´½¨Ò»Ð©ÕªÒª±í¡£
ÒÔÏÂÊÇmysqlËøµÄһЩ½¨Ò飺
Ö»Òª¶Ôͬһ¸ö±íûÓдóÁ¿µÄ¸üкͲéѯ²Ù×÷»ìÔÚÒ»Æð£¬Ä¿Ç°µÄÓû§²¢²»ÊÇÎÊÌâ¡£
Ö´ÐÐLOCK TABLESÀ´Ìá¸ßËÙ¶È(ºÜ¶à¸üвÙ×÷·ÅÔÚÒ»¸öËøÖÐ ±ÈûÓÐËøµÄ ºÜ¶à¸üпì¶àÁË),½«Êý¾Ý²ð·Ö¿ªµ½¶à¸ö±íÖпÉÄÜÒ²ÓаïÖú¡£
µ±mysqlÅöµ½ÓÉÓÚËø±íÒýÆðµÄËÙ¶ÈÎÊÌâʱ£¬½«±íÀàÐÍת»»³ÉInnoDB»òBDB¿ÉÄÜÓÐÖúÓÚÌá¸ßÐÔÄÜ¡£
ÊÂÎñ´¦ÀíºÍ²¢·¢ÐÔ
1.È«²¿µÄ±íÀàÐͶ¼¿ÉÒÔʹÓÃËø£¬µ«ÊÇÖ»ÓÐInnoDBºÍBDB²ÅÓÐÄÚÖõÄÊÂÎñ¹¦ÄÜ
2.ʹÓÃbegin¿ªÊ¼ÊÂÎñ£¬Ê¹ÓÃcommit½áÊøÊÂÎñ£¬Öмä¿ÉÒÔʹÓÃrollback»Ø¹öÊÂÎñ¡£
3.ÔÚĬÈÏÇé¿öÏ£¬InnoDB±íÖ§³ÖÒ»Ö¶Á¡£
SQL±ê×¼Öж¨ÒåÁË4¸ö¸ôÀ뼶±ð£ºread uncommited,read commited, repeatable read, serializable.
read uncommited¼´Ôà¶Á£¬Ò»¸öÊÂÎñÐÞ¸ÄÁËÒ»ÐУ¬ÁíÒ»¸öÊÂÎñÒ²¿ÉÒÔ¶Áµ½¸ÃÐС£
Èç¹ûµÚÒ»¸öÊÂÎñÖ´ÐÐÁ˻عö£¬ÄÇôµÚ¶þ¸öÊÂÎñ¶ÁÈ¡µÄ¾ÍÊÇ´ÓÀ´Ã»ÓÐÕýʽ³öÏÖ¹ýµÄÖµ¡£
read commited¼´Ò»Ö¶Á£¬ÊÔͼͨ¹ýÖ» ¶ÁÈ¡Ìá½»µÄÖµµÄ·½Ê½À´½â¾öÔà¶ÁµÄÎÊÌ⣬µ«ÊÇÕâÓÖÒýÆðÁ˲»¿ÉÖظ´¶ÁÈ¡µÄÎÊÌâ¡£
Ò»¸öÊÂÎñÖ´ÐÐÒ»¸ö²éѯ£¬¶ÁÈ¡ÁË´óÁ¿µÄÊý¾ÝÐУ¬ÔÚËü½áÊø¶Áȡ֮ǰ£¬ÁíÒ»¸öÊÂÎñ¿ÉÄÜÒѾÍê³ÉÁ˶ÔÊý¾ÝÐеĸü¸Ä¡£µ±µÚÒ»¸öÊÂÎñ
ÔÙ´ÎÖ´ÐÐͬһ¸ö²éѯ£¬·þÎñÆ÷¾Í»á·µ»Ø²»Í¬µÄ½á¹û¡£
repeatable read¼´¿ÉÖظ´¶Á£¬ÔÚÒ»¸öÊÂÎñ¶ÔÊý¾ÝÐÐÖ´ÐжÁÈ¡»òдÈë²Ù×÷ʱËø¶¨ÁËÕâЩÊý¾ÝÐС£µ«ÊÇÕâÖÖ·½Ê½ÓÖÒý·¢ÁË»ÃÏë¶ÁµÄ
ÎÊÌâ¡£ ÒòΪֻÄÜËø¶¨ ¶ÁÈ¡»òдÈëµÄÐУ¬²»ÄÜ×èÖ¹ÁíÒ»¸öÊÂÎñ²åÈëÊý¾Ý£¬ºóÆÚÖ´ÐÐͬÑùµÄ²éѯ»á²úÉú¸ü¶àµÄ½á¹û¡£
serializ
Ïà¹ØÎĵµ£º
Ò»¡¢MYSQLµÄµ¼³ö
½øÈëmysql°²×°Ä¿Â¼£¬½øÈëbin
ÔÚÃüÁîÐÐģʽÏ´òÈ룺
³ÌÐò´úÂë
mysqldump -u root -p hibernate > c:/hibernate.sql
ÆäÖÐ-u ±íʾÓû§
-p±íʾÓû§ÐèÒªÈÏÖ¤
hibernate±íʾҪµ¼³öµÄÊý¾Ý¿â
> c:/hibernate ±íʾ½«Ê ......
Ò»¡¢±íµ¥Ìá½»ÂÒÂë½â¾ö·½·¨
±íµ¥Öк¬ÓÐÖÐÎÄÌá½»ÂÒÂ룬¶ÔÓÚ×ÖĸºÍÊý×ÖÔò²»»áÂÒÂ룬ÎÒÑ¡ÓõÄ×Ö·û¼¯utf-8(ÒÔÏÂͬ)¡£
1¡¢ÔÚapache-tomcat-6.0.18\webapps\examples\WEB-INF\classes\filtersĿ¼ÏÂÕÒµ½ÎļþSetCharacterEncodingFilter.java ºÍRequestDumperFilter.javaÎļþ£¬²¢½«Æ临ÖƵ½ÏîÄ¿src ......
JavaÁ¬½ÓmysqlÊý¾Ý¿â£¬´úÂë¾¹ýÔËÐÐ׼ȷÎÞÎó¡£
ÏÂÃæΪʵÀý---->
ÓÃÊý¾Ý¿â²Ù×ݹ¤¾ß£¨Àý£ºSQLyogEnt£©²Ù×Ýmysql½¨±í£¬»òdosϽ¨£¬ÈçÏ£º
Êý¾Ý¿âÃû£ºscutcs
±íÃû£ºstudent
±íÄÚÈÝ£º
sno char[7] NO NULL Primary Key;
sname varchar[8] NO NULL;
sex char[2] NO NULL; ......
À´Ô´£ºhttp://blog.csdn.net/ldb2741/archive/2010/02/25/5325161.aspx
×öÏîĿʱÓÉÓÚÒµÎñÂß¼µÄÐèÒª£¬±ØÐë¶ÔÊý¾Ý±íµÄÒ»Ðлò¶àÐмÓÈëÐÐËø£¬¾Ù¸ö×î¼òµ¥µÄÀý×Ó£¬Í¼Êé½èÔÄϵͳ¡£¼ÙÉè id=1 µÄÕâ±¾Êé¿â´æΪ 1 £¬µ«ÊÇÓÐ 2 ¸öÈËͬʱÀ´½èÕâ±¾Ê飬´Ë´¦µÄÂ߼Ϊ
view plaincopy to clipboardprint?
Select restnum&nbs ......