ÈçºÎÈÃmysqlÖ§³ÖÖÐÎÄgbk×Ö·û¼¯
ÔÚmysqlÊý¾Ý¿âÖУ¬Ê¹ÓõÄÊÇlatin×Ö·û¼¯£¬ËùÒÔÎÞ·¨Õý³£µÄÖ§³ÖÖÐÎÄ×Ö·û£¬ÖÐÎÄÔÚÊý¾Ý¿âÖÐÏÔʾΪÂÒÂë“£¿”ºÅ¡£ÎªÁËÈÃmysql¿ÉÒÔÕý³£Ê¹ÓÃÖÐÎÄ£¬ÓÈÆäÊǵ±Ê¹ÓÃjspÁ¬½ÓmysqlµÄʱºò£¬ÎÒÃÇÐèҪʹÓÃgbkµÄ×Ö·û¼¯£¬Òò´ËÎÒÃÇÒª¶Ômysql½øÐÐÒÔÏÂÉèÖã¬ÒÔ±ãÆäÓÐЧµÄÖ§³ÖÖÐÎÄ£º
IXDBA.NET¼¼ÊõÉçÇø
1.ÐÞ¸Ämy.cnfÎļþ
my.cnfÎļþÊÇmysqlµÄÅäÖÃÎļþ£¬ÎÒÃÇ¿ÉÒÔ´ÓmysqlµÄ°²×°Ä¿Â¼¸ù¾ÝÆä×Ô´øÄ£°åÀ´
½¨Á¢
#cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf
#vi /etc/my.cnf
ÔÚ´ËÎļþÖÐÏàӦλÖüÓÈë
default-character-set = gbk
########################
[client]
default-character-set = gbk
[mysqld]
default-character-set = gbk
#########################
Ð޸ĽáÊøÒԺ󣬱£´æ£¬È»ºóʹÓÿͻ§¶ËµÇ¼
#mysql -u root -p
ÔÚ¿Í»§¶ËÖÐÊäÈë
>status;
ÏÔʾµÄÊý¾ÝÖÐÈç¹û³öÏÖ£º
Server characterset: gbk
Db characterset: gbk
Client characterset: gbk
Conn. characterset: gbk
Ôò±íʾÐ޸ijɹ¦¡£
2.½¨Á¢¿â±íʱָ¶¨gbk×Ö·û¼¯
ÔÚ½¨Á¢¿â±íµÄʱºòÎÒÃÇÐèÒªÖ¸¶¨gbk×Ö·û¼¯
½¨Á¢Êý¾Ý¿â£º
CREATE DATABASE dbname DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci
½¨Á¢Êý¾Ý±í
Create table tablename(
id int(10) unsigned NOT NULL AUTO_INCREMENT,
name varchar(15) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM DEFAULT CHARACTER SET gbk
½¨Á¢ºÃÒÔºó£¬ÔÚ¿Í»§¶ËÖÐʹÓãº
>show cereate table tablename;
Èç¹û×îºóÒ»ÐÐÏÔʾgbk£¬Ôò±íʾ³É¹¦
3.ÐÞ¸ÄjdbcÇý¶¯
jspÁ¬½ÓmysqlÐèҪʹÓÃjdbcÇý¶¯£¬ÔÚʹÓõÄʱºò£¬ÎÒÃÇÐèÒªÉèÖúÃ×Ö·û¼¯
String user="root";
String password="123";
String url="jdbc:mysql://localhost:3306/dbname?useUnicode=true&characterEncoding=gbk"
Class.forNname("com.mysql.jdbc.Driver");//×°ÔØÇý¶¯Àࣻ
Connection con=DriverManager.getConnection(url,user,password);//È¡µÃÁ¬½Ó
ÆäÖÐdbnameΪÄãÊý¾Ý¿âµÄÃû×Ö£¬urlÖеÄgbk¼´ÎªÊ¹ÓõÄ×Ö·û¼¯
×öºÃÒÔÉÏÈý²½ÒÔºó£¬mysql¾Í¿ÉÒÔÖ§³ÖgbkÖÐÎÄÁË¡£
Ïà¹ØÎĵµ£º
1¡¢ÏÂÔØMySQLµÄ°²×°Îļþ
°²×°MySQLÐèÒªÏÂÃæÁ½¸öÎļþ£º
MySQL-server-5.0.46.i386.rpm¡¡¡¡¡¡
MySQL-client-5.0.46.i386.rpm
2¡¢°²×°MySQL
rpmÎļþÊÇRed Hat¹«Ë¾¿ª·¢µÄÈí¼þ°²×°°ü£¬rpm¿ÉÈÃLinuxÔÚ°²×°Èí¼þ°üʱÃâ³ýÐí¶à¸´ÔÓµÄÊÖÐø¡£¸ÃÃüÁîÔÚ°²×°Ê±³£ÓõIJÎÊýÊÇ
ivh
,ÆäÖÐi±íʾ½«°²×°Ö¸¶¨µÄrmpÈí¼þ°ü£¬V±í ......
1¡¢°²×°Tomcat
JDBCÁ¬½Ó³ØÅäÖõĵÚÒ»²½ÊÇÏÂÔغͰ²×°Tomcat¡£²Î¿¼Tomcat for window µÄ°²×°Ïòµ¼£¬»ù±¾Ö±½Ó°²×°¼´¿É£¬×¢Ò⣺°²×°Ê±»áÌáʾÊäÈë¹ÜÀíÓû§ÃûºÍÃÜÂ룬ÕâÊÇÒÔºó»áÓõ½µÄÓû§ÃûºÍÃÜÂ룬Çмǡ£
2¡¢°²×°MySql
ĬÈÏ°²×°¼´¿É¡£
3¡¢Ê¹ÓÃTomcatµÄWeb¹ÜÀíÓ¦ÓÃÅäÖÃÊý¾ÝÔ´
Æô¶¯Tomcat·þÎñÆ÷£¬´ò¿ªä¯ÀÀÆ÷£¬ÊäÈëhttp://loca ......
ÔÚ±íÖÐÒÑÓдóÁ¿µÄindexµÄÇé¿öϲåÈë´óÁ¿Êý¾Ý£¬¿ÉÒÔ²ÉÓÃÏȽ«Ë÷Òýɾ³ý£¬È»ºóÔÙ²åÈëÊý¾Ý£¬È»ºóÔÙÖØн¨Á¢Ë÷Òý¡£Ö®ËùÒÔÕâÑù»á¿ìÊÇÒòΪ£¿£¿£¿
7.2.14 Speed of INSERT Statements
The time to insert a record is determined by the following factors, where the numbers indicate approximate proportions:
& ......
* mysqlÊ×ÏȽ«Äõ½µÄÊý¾Ýת»»Îªcharacter_set_clientÖ¸¶¨µÄ±àÂë¸ñʽ£¬È»ºóת»»Îª character_set_connectionÖ¸¶¨µÄ¸ñʽ£¬×îºóÔÙ½«Êý¾Ý´æ´¢µ½Êý¾Ý¿â£¬´æ´¢¸ñʽΪcharacter_set_databaseËùÖ¸¶¨µÄ¸ñʽ£»
* ´ÓÊý¾Ý¿â¶ÁÊý¾Ýʱ£¬½«Êý¾Ý¿â¸ñʽת»»Îªcharacter_set_resultsÖ¸¶¨µÄ¸ñʽ£¬ÔÙ·¢Ë ......
## **********first test,procedure**********
#<1>
use testprocedure;
delimiter //
create procedure simpleproce1 (out par1 int)
begin
select count(*) into par1 from proce;
end
//
delimiter ;
call simpleproce1(@a);
select @a;
#<2>,ÿ´ÎÖ»Óе¥Ò»µÄÐпÉÒÔ±»È¡»Øselect id,name i ......