Tomcat+mysqlÁ¬½Ó³ØµÄÅäÖÃÓë²âÊÔ
»·¾³:
Tomcat6.0.18
Mysql: 5.1.36
Windwos XP sp2
×î½üÐèÒªÓõ½Tomcat+mysqlÁ¬½Ó³ØµÄÅäÖÃ,½ñÌìÔÚÍøÉϲéÁ˺öà×ÊÁÏ,ÀÏ×ÊÁÏÌ«¶à,¶ÔÓÚÒÔÉϵÄÀÏ°æ±¾tomcat¿ÉÄÜÓÐÓÃ,±¾ÈËûÓвâÊÔ¹ý,Õýȷд³ötomcat6.0ÅäÖõÄÎļäºÜÉÙ!ºÃ¶à×ÊÁÏÉÏÃæµÄÅäÖöÔÓÚÏÖÔÚаæµÄ¼¸ºõ¶¼ÊÇÓÐÎÊÌâµÄ,Ê®´íÆß°Ë!½ñÌì°ÑÎÒÅäÖõÄÕýÈ··½·¨Ð´ÏÂÀ´,¹©´ó¼Ò²Î¿¼!
1.°²×°tomcat,ÂÔ;
2.°²×°mysqlÂÔ,
½øÈëmysql,н¨Êý¾Ý¿âtest1;
test1 Êý¾Ý¿â Öн¨±ípet,±í½á¹¹ÈçÏÂ;
mysql> desc pet;
+---------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+----------+------+-----+---------+-------+
| name | char(20) | YES | | NULL | |
| owner | char(20) | YES | | NULL | |
| species | char(20) | YES | | NULL | |
| sex | char(1) | YES | | NULL | |
| birth | date | YES | | NULL | |
| death | date | YES | | NULL | |
+---------+----------+------+-----+---------+-------+
¼ÓÈëһЩÊý¾Ý;
INSERT INTO pet VALUES ('Öí°Ë½ä','ÌÆÉ®','ÉñÏÉ','f','2001-12-01',NULL);
ÕâÀï×¢Òâmysql±í×Ö·û¼¯ÉèÖÃ,ºÜÓпÉÄÜÔÚ¿Í»§¶ËºÍJSPÖÐÂÒÂë,¿É²Î¿¼ÎÒдµÄÎÄÕÂ:
eclipseÁ¬½ÓmysqlÂÒÂë¼°mysql[ERROR 1366 (HY000):´íÎó]
http://c02949.blog.163.com/blog/static/485037200962345218147/
ÍøÉÏËѵ½µÄºÃ¶à×ÊÁÏ˵:tomcatÅäÖÃmysqlÁ¬½Ó³ØÐèÒª¸Ä:
ÅäÖÃtomcatϵÄconfϵÄcontext.xml
ÅäÖÃtomcatϵÄconfϵÄwebt.xml
ÅäÖÃtomcatϵÄconfϵÄserver.xml ÂÒÆß°ËÔã,º¦ÎÒ°ÑTomcat6.0ÖØ×°Ò»´Î!ÀË·ÑÁ˺öàʱ¼ä.
ÕýÈ·µÄÅäÖ÷½·¨Ö»ÐèÒªÐÞ¸Äcontext.xmlºÍweb.xmlÁ½¸öÎļþ:
context.xmlÔÚ<context></context>Ö®¼äÌí¼ÓÁ¬½Ó³ØÈçÏÂ:
<Resource name="jdbc/mysql" auth="Container"
type="javax.sql.DataSource"
maxActive="50" maxIdle="10" maxWait="5000"
username="ÄãµÄmysqlÓû§" password="ÄãµÄmysqlÃÜÂë"
driverClass
Ïà¹ØÎĵµ£º
1.±àдshell½Å±¾
vi /data/www/project_name/bin/mysql_backup.sh
#!/bin/bash
#This is a ShellScript For Auto DB Backup
#Powered by liuzheng
#ϵͳ±äÁ¿¶¨Òå
DBName=test
DBUser=root
DBPasswd=123456
BackupPath=/tmp/mysql_backup/
NewFile="$BackupPath"db$(date +%y%m%d ......
Hibernate MySQL ÖÐÎÄÂÒÂëÎÊÌâ
»·¾³£ºHibernate 2.1.7 + MySQL4.1£¨MySQLµÄ±àÂëÒÑÉèÖÃΪutf8£©
ÎÊÌ⣺ͨ¹ýHibernateÏòMySQLдÈëÖÐÎĺó£¬Í¨¹ýHibernateÈ¡»ØÊý¾Ý£¬ÔÚconsoleÖдòÓ¡java¶ÔÏóÏÔʾÕý³£¡£µ«ÔÚMySQL Query BrowserÖп´µ½µÄÊÇÂÒÂ룬´«¸øÇ°¶ËµÄFlexÒ²ÊÇÂÒÂë¡£
ÔÒò£ºHibernateµÄ»ù´¡»¹ÊÇJDBC£¬ËùÒÔÒ»ÑùÐèÒªÉèÖà ......
MySQLÖ§³Öµ¥Ïò¡¢Òì²½¸´ÖÆ£¬¸´Öƹý³ÌÖÐÒ»¸ö·þÎñÆ÷³äµ±Ö÷·þÎñÆ÷£¬¶øÒ»¸ö»ò¶à¸öÆäËü·þÎñÆ÷³äµ±´Ó·þÎñÆ÷¡£Ö÷·þÎñÆ÷½«¸üÐÂдÈë¶þ½øÖÆÈÕÖ¾Îļþ£¬²¢Î¬»¤ÈÕÖ¾ÎļþµÄÒ»¸öË÷ÒýÒÔ¸ú×ÙÈÕ־ѻ·¡£µ±Ò»¸ö´Ó·þÎñÆ÷Á¬½Óµ½Ö÷·þÎñÆ÷ʱ£¬Ëü֪ͨÖ÷·þÎñÆ÷´Ó·þÎñÆ÷ÔÚÈÕÖ¾ÖжÁÈ¡µÄ×îºóÒ»´Î³É¹¦¸üеÄλÖᣴӷþÎñÆ÷½ÓÊÕ´ÓÄÇʱÆð·¢ÉúµÄÈκθüУ¬È ......
˵Ã÷: ÔÚMYSQLÖУ¬Èç¹ûʹÓÃȱʡµÄ×Ö·û¼¯£¬ÔÚ½¨¿â¡¢½¨±íʱ£¬Ä¬ÈÏʹÓõÄÊÇlatin1×Ö·û¼¯£¬
ΪISO 8859-1Î÷Å·×Ö·û¼¯¡£²åÈëÖÐÎÄ×Ö·ûʱ£¬ÓëÖ®²»Æ¥Å䣬¾Í»á³öÏÖÂÒÂë¡£
¡¾½â¾ö·½°¸¡¿
1. ´ò¿ªÎļþ: C:\Program Files\MySQL\MySQL Server 5.0\my.ini;
2. ½«ÆäÖеÄdefault-character-set=latin1¸ÄΪdefault-character-set=gb2312,
......
Ò») Á¬½ÓMYSQL£º
¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû £pÓû§ÃÜÂë
1¡¢Àý1£ºÁ¬½Óµ½±¾»úÉϵÄMYSQL
Ê×ÏÈÔÚ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëmysql°²×°Ä¿Â¼ÏµÄbinĿ¼Ï£¬ÀýÈ磺 D:\mysql\bin£¬ÔÙ¼üÈëÃüÁîmysql -uroot -p£¬»Ø³µºóÌáʾÄãÊäÃÜÂë
£¬Èç¹û¸Õ°²×°ºÃMYSQL£¬³¬¼¶Óû§rootÊÇûÓÐÃÜÂëµÄ£¬¹ÊÖ±½Ó»Ø³ ......