ʹÓÃC3P0Á¬½ÓMysqlµÄÒ»¸öÎÊÌâµÄ½â¾ö¹ý³Ì
×î½üµÄÒ»¸öÏîÄ¿ÔÚʹÓÃC3P0µÄÁ¬½Ó³Ø£¬Êý¾Ý¿âΪMysql¡£¿ª·¢²âÊÔûÓÐÎÊÌ⣬ÔÚÔËÐÐÖÐÿ¸öÒ»¶Î³¤µÄ¿ÕÏÐʱ¼ä¾Í³öÏÖÒì³£Communications link failure due to underlying exception:
java ´úÂë
²é¿´ÁËMysqlµÄÎĵµ£¬ÒÔ¼°Connector/JµÄÎĵµÒÔ¼°ÔÚÏß˵Ã÷·¢ÏÖ£¬³öÏÖÕâÖÖÒì³£µÄÔÒòÊÇ£º
Mysql·þÎñÆ÷ĬÈϵēwait_timeout”ÊÇ8Сʱ£¬Ò²¾ÍÊÇ˵һ¸öconnection¿ÕÏг¬¹ý8¸öСʱ£¬Mysql½«×Ô¶¯¶Ï¿ª¸Ãconnection¡£Õâ¾ÍÊÇÎÊÌâµÄËùÔÚ£¬ÔÚC3P0 poolsÖеÄconnectionsÈç¹û¿ÕÏг¬¹ý8Сʱ£¬Mysql½«Æä¶Ï¿ª£¬¶øC3P0²¢²»ÖªµÀ¸ÃconnectionÒѾʧЧ£¬Èç¹ûÕâʱÓÐClientÇëÇóconnection£¬C3P0½«¸ÃʧЧµÄConnectionÌṩ¸øClient£¬½«»áÔì³ÉÉÏÃæµÄÒì³£¡£
½â¾öµÄ·½·¨ÓÐ3ÖÖ£º
Ôö¼Ówait_timeoutµÄʱ¼ä¡£
¼õÉÙConnection poolsÖÐconnectionµÄlifetime¡£
²âÊÔConnection poolsÖÐconnectionµÄÓÐЧÐÔ¡£
µ±È»×îºÃµÄ°ì·¨ÊÇͬʱ×ÛºÏʹÓÃÉÏÊö3ÖÖ·½·¨£¬¼ÙÉèwait_timeoutΪĬÈϵÄ8Сʱ
C3P0Ôö¼ÓÒÔÏÂÅäÖÃÐÅÏ¢:
//»ñÈ¡connnectionʱ²âÊÔÊÇ·ñÓÐЧ
testConnectionOnCheckin = true
//×Ô¶¯²âÊÔµÄtableÃû³Æ
automaticTestTable=C3P0TestTable
//set to something much less than wait_timeout, prevents connections from going stale
idleConnectionTestPeriod = 18000
//set to something slightly less than wait_timeout, preventing 'stale' connections from being handed out
maxIdleTime = 25000
//if you can take the performance 'hit', set to "true"
testConnectionOnCheckout = true
¸ü¶àµÄÅäÖÃÐÅÏ¢´ó¼Ò¿ÉÒԲ鿴C3P0Îĵµ£¬Connector/JÎĵµ£¬
Ïà¹ØÎĵµ£º
×î½üÓöµ½Ò»¸öÐèÇóÒªÔÚlinuxÏÂÓÃjava µ÷ÓÃmysql¿Í»§¶ËÔ¶³ÌµÇ½mysql·þÎñÆ÷£¬´Ó¿Í»§¶Ë»úÆ÷µ¼Èëmysql½Å±¾£¬´Ómysql·þÎñÆ÷¶Ëµ¼³ö±íÖеÄÊý¾Ý¡£ÒÔÏÂÊÇÓõ½µÄÖ÷Òª·½·¨£º
Java ´úÂë
/**
* µ¼ÈëÊý¾Ý
* @param ½Å±¾µÄµØÖ·ºÍÃû³Æ
* @return ÊÇ·ñ³ ......
http://blog.csdn.net/digyso888/archive/2008/12/18/3552981.aspx
MySQL°²×°µÄͼ½â5.0.28 ÊÕ²Ø
MySQL°²×°µÄͼ½â£¨×îа棩¡¡¡¡´ò¿ªÏÂÔصÄmysql°²×°Îļþmysql-5.0.27-win32.zip£¬Ë«»÷½âѹËõ£¬ÔËÐГsetup.exe”£¬³öÏÖÈçϽçÃ棺
¡¡¡¡mysql°²×°Ïòµ¼Æô¶¯£¬°´“Next”¼ÌÐø
¡¡¡¡Ñ¡Ôñ° ......
## Á¬½Ó·ûÓë# ·û
¡¡¡¡## Á¬½Ó·ûºÅÓÉÁ½¸ö¾®ºÅ×é³É£¬Æ书ÄÜÊÇÔÚ´ø²ÎÊýµÄºê¶¨ÒåÖн«Á½¸ö×Ó´®(token)Áª½ÓÆðÀ´£¬´Ó¶øÐγÉÒ»¸öеÄ×Ó´®¡£µ«Ëü²»¿ÉÒÔÊǵÚÒ»¸ö»òÕß×îºóÒ»¸ö×Ó´®¡£ËùνµÄ×Ó´®(token)¾ÍÊÇÖ¸±àÒëÆ÷Äܹ»Ê¶±ðµÄ×îСÓï·¨µ¥Ôª¡£¾ßÌåµÄ¶¨ÒåÔÚ±àÒëÔÀíÀïÓÐÏ꾡µÄ½âÊÍ£¬µ«²»ÖªµÀÒ²ÎÞËùν¡£Í¬Ê±ÖµµÃ×¢ÒâµÄÊÇ#Á¬½Ó·ûÊÇ°Ñ´«µÝ¹ý ......
1.Linux“Ï߳̔
½ø³ÌÓëÏß³ÌÖ®¼äÊÇÓÐÇø±ðµÄ£¬²»¹ýLinuxÄÚºËÖ»ÌṩÁËÇáÁ¿½ø³ÌµÄÖ§³Ö£¬Î´ÊµÏÖÏß³ÌÄ£ÐÍ¡£LinuxÊÇÒ»ÖÖ“¶à½ø³Ìµ¥Ï߳̔µÄ²Ù×÷ϵͳ¡£Linux±¾ÉíÖ»Óнø³ÌµÄ¸ÅÄ¶øÆäËùνµÄ“Ï߳̔±¾ÖÊÉÏÔÚÄÚºËÀïÈÔÈ»Êǽø³Ì¡£
´ó¼Ò ......
1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°È ......