Tomcat+MySQl JDBCÁ¬½Ó³ØµÄÅäÖÃ
1¡¢°²×°Tomcat
JDBCÁ¬½Ó³ØÅäÖõĵÚÒ»²½ÊÇÏÂÔØºÍ°²×°Tomcat¡£²Î¿¼Tomcat for window µÄ°²×°Ïòµ¼£¬»ù±¾Ö±½Ó°²×°¼´¿É£¬×¢Ò⣺°²×°Ê±»áÌáʾÊäÈë¹ÜÀíÓû§ÃûºÍÃÜÂ룬ÕâÊÇÒÔºó»áÓõ½µÄÓû§ÃûºÍÃÜÂ룬Çмǡ£
2¡¢°²×°MySql
ĬÈϰ²×°¼´¿É¡£
3¡¢Ê¹ÓÃTomcatµÄWeb¹ÜÀíÓ¦ÓÃÅäÖÃÊý¾ÝÔ´
Æô¶¯Tomcat·þÎñÆ÷£¬´ò¿ªä¯ÀÀÆ÷£¬ÊäÈëhttp://localhost:8080/admin/£¨ÆäÖÐlocalhost¿ÉÄÜÊÇһ̨»úÆ÷µÄIP»òÊÇ·þÎñÆ÷Ãû³Æ£©£¬½øÈë¹ÜÀí½çÃæµÄµÇÂ½Ò³Ãæ£¬ÕâʱºòÇëÊäÈëÔÀ´°²×°Ê±ÒªÇóÊäÈëµÄÓû§ÃûºÍÃÜÂ룬µÇ½µ½¹ÜÀí½çÃæ£¬
Ñ¡ÔñResources£Data sources½øÈëJDBCÁ¬½Ó³ØÅäÖÃÊý¾ÝÔ´½çÃæ£¬Ñ¡ÔñData Source Actions £>Ñ¡ÔñCreate New Data Source,½øÈëÅäÖÃÏêϸÐÅÏ¢½çÃæ£¬ÄÚÈÝÈçÏ£º
JNDI Name: jdbc/mysql Data Source URL: jdbc:mysql://192.168.0.16/SUBRDB JDBC Driver Class: org.gjt.mm.mysql.Driver User Name: root Password: ******** Max. Active Connections: 4 Max. Idle Connections: 2 Max. Wait for Connection: 500 Validation Query:
ÒªÇóÊäÈëµÄJNDI NameµÈÐÅÏ¢£¬ÆäÖгýÁËJDBC DriverClassÖ®Í⣬ÆäËûµÄ¿ÉÒÔ¸ù¾ÝÄãµÄÐèÒªÌîд¡£±ÈÈçData Source URLµÄÄÚÈÝ¿ÉÄÜÊÇ£ºjdbc:mysql:// IP»òÊÇÃû³Æ/DataBaseName£¬ÆäÖÐDataBaseNameÊÇÄãµÄÊý¾Ý¿âÃû³Æ£¬IPÊÇÄãµÄÊý¾Ý¿âµÄËùÔڵķþÎñÆ÷µÄIP»òÊÇÃû³Æ¡£×îºóµã»÷Save£>Commit Change.ÕâÑùÄãµÄÊý¾ÝÔ´µÄ»ù±¾×ÊÁÏÅäÖÃÒ»°ëÁË¡£
4¡¢web.xmlºÍ%TOMCAT_HOME%\conf\Catalina\localhost϶ÔÓ¦ÄãµÄÒýÓõÄÅäÖÃÎļþÐÞ¸Ä
ͨ¹ýÎļþ¼Ðµ¼º½µ½%TOMCAT_HOME%\conf£¬´ò¿ªweb.xml,ÔÚ</web-app>µÄÇ°ÃæÌí¼ÓÒÔÏÂÄÚÈÝ£º
<resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/mysql</res-ref-name> <res-type>javax.sql.DataSource</res-type>
Ïà¹ØÎĵµ£º
ת×Ô:http://blog.chinaunix.net/u2/85344/showart_2042280.html
LiunxÏÂÐÞ¸ÄMySQL×Ö·û¼¯£º
1.²éÕÒMySQLµÄcnfÎļþµÄλÖÃ
find / -iname '*.cnf' -print
/usr/share/mysql/my-innodb-heavy-4G.cnf
/usr/share/mysql/my-large.cnf
/usr/share/mysql/my-small.cnf
/usr/share/mysql/my-medium.cnf
/usr/share/mysql ......
Ê×ÏÈÐèÒªÐ¶ÔØredhat×Ô´øµÄmysqlÊý¾Ý¿â£¨²»È»°²×°Ê±»á³öÎÊÌ⣩
rpm -qa|grep mysql
È»ºó rpm -e °üÃû³Æ
Èç¹ûÉæ¼°µ½ÒÀÀµ£¬¾ÍÏÈɾ³ýÒÀÀµ£¬»òÕß¼Ó¸ö -nodeps ²ÎÊýºöÂÔÒÀÀµ
ÓÐÍøÓÑ˵ÓÃyum -y remove mysqlÒ²¿ÉÒÔ
ÁíÒ»¸ö½â¾ö·½·¨Ê±ÔÚlinux×Ô´ømysql»ù´¡ÉÏÔÙװеÄmysql
¶þ½øÖư²×°°ü°æ±¾ºÜ¶à£¬³£ÓõľÍÁ½¸ö£¬ÎÒϵÄÊÇ ......
ÈçºÎÌá¸ßmysql load
data
infile
µÄËÙ¶È
²âÊÔÊý¾Ý2.5G£¬¹²ÓÐÊý¾Ý9427567Ìõ¡£ÓõÄmysqlµÄlarge·þÎñÆ÷µÄÅäÖá£
load
Ò»´ÎÐèÒª´ó¸Å10·ÖÖÓ×óÓÒ¡£
½¨µÄ±íÓõÄÊÇMYISAM£¬µ÷ÕûÁ˼¸¸ösessionµÄ²ÎÊýÖµ
SET SESSION BULK_INSERT_BUFFER_SIZE=256217728;
SET SESSION MYISAM_SORT_BUFFER_SIZE=256217728;
ÔËÐнá¹ûÈçÏÂ
Qu ......
²î²»¶àÔÚÒ»Äêǰ£¬Ð´¹ýһƪÎÄÕ½éÉܽ«MySQLÊý¾ÝÓ³Éäµ½Memcached£¬µ±Ê±MySQLºÍMemcached Functions for MySQL¶¼»¹²»¹»³ÉÊ죬ʱ¹ýÒ»Ä꣬Memcached Functions for MySQLÉý¼¶µ½ÁË0.8°æ±¾£¬¶øMySQLÒ²·¢²¼ÁËGA°æ±¾£¬¼ÓÉϺܶàÅóÓÑ·´Ó¦Ç°Ò»ÆªÎÄÕÂÖеÄʵÏÖËûÃÇÒòÖÖÖÖÔÒòûÄܳɹ¦£¬ÓÚÊDZãÓÐÁËÕâÆªÎÄÕ£¬¾Íµ±ÊÇÉÏһƪÎÄÕµÄÉý¼¶°æ±¾°É¡ ......