Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaÓëmysqlÂÒÂëµÄÎÊÌâ [ת]

½â¾ö·½·¨Ò»:(×îÖØÒªµÄÒ»ÖÖ·½·¨)
Äã¿´ÏÂmy.ini£¬ÓÐÎÞ
[mysql]
default-character-set=utf8
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
È»ºó½¨Á¢±íʱ£¬Ò²ÒªÓ㨱ÈÈ磩
DROP   TABLE   IF   EXISTS   `Company`;
CREATE   TABLE   IF   NOT   EXISTS   `Company`
(
    `Cname`   VARCHAR(10)   NOT   NULL,
    `Caddr`   VARCHAR(100),
    `Ctel`     VARCHAR(16)
)ENGINE=InnoDB   DEFAULT   CHARSET=UTF8;
ÕâÑù¾ÍûÎÊÌâ¡£
Èç¹ûÊÇjspÒªÉùÃ÷£º
contentType="text/html;charset=gb2312"
½â¾ö·½·¨¶þ£º
Á¬½Ómysqlʱ(ÎÞÂÛÔÚ´Ómysql¶Á»¹ÊÇÈ¡Êý¾ÝµÄÇé¿ö)£¬Ö¸¶¨Ê¹ÓõıàÂ뷽ʽΪutf-8£¬¾ßÌå´úÂëÈçÏÂ
//×°ÔØmysql-jdbcÇý¶¯
Class.forName("com.mysql.jdbc.Driver").newInstance();
//Á¬½ÓÊý¾Ý¿â
Connection sqlCon = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test?                         user=root&password=1&useUnicode=true&characterEncoding=utf-8" );
½â¾ö·½·¨Èý£º
Èç¹û·½·¨Ò»²»ÐÐÄÇôÔÚ·½·¨Ò»µÄ»ù´¡É϶ԶÁÈëµÄ×Ö·û´®½øÐÐÇ¿ÖƱàÂ뷽ʽת»»¡£
´úÂëʾÀýÈçÏ£º
String name = rst.getString("name");
name= new String(name.getBytes("ISO-8859-1"),"utf-8");
×¢£º´úÂëÒ²¿ÉÒÔΪ£ºString name =new String( rst.getString("name").getBytes("ISO-8859-1"),"utf-8"));ÆäÖÐrstΪ·µ»ØµÄresultset,ISO-8859-1ΪmysqlĬÈϵıàÂ뷽ʽ£¬´úÂëµÄÄ¿µÄÊÇ°ÑÒÔISO-8859-1µÄ±àÂëת»»Îªgb2312±àÂ뷽ʽ£¬ÕâÑùÇ¿ÖÆת»»£¬¿ÉÒÔ½â¾öÒ»²¿·ÖÎÊÌ⣬Èç¹û½áºÏ·½·¨Ò»£¬Ó¦¸Ã¿ÉÒÔ½â¾öÖÐÎÄÂÒÂëÎÊÌâ¡£
½â¾ö·½·¨ËÄ£º
Õâ¸ö·½·¨ÔÚÓÐЩÎÄÕÂÀïÊÇÊ×ÍƵģ¬ÎÒÊ×ÏÈÒ²ÊÇÊÔÁËÕâ¸ö·½·¨£¬µ«ÊǺÃÏñ²»ÐС£ÕâÀﻹÊÇ˵һÏ£¬²»ÖªÊDz»ÊÇÎÒ²Ù×÷´íÎó¡£»¹ÊÇÏÈÌùÔ­ÎÄ°É£º
"Èç¹ûÊý¾Ý¿âÖÐÓÐÖÐÎĵĻ°¶ømysqlĬÈϵÄÓïÑÔ²»ÊÇÖÐÎÄʱҪÔÚÅäÖÃÎļþC:winntmy.ini ÖÐµÄ [mysqld] ÀïÌí¼ÓÒ»ÐУº
default-character-set=utf-


Ïà¹ØÎĵµ£º

mysql source µ¼Èëµ¼³öÊý¾ÝΪÂÒÂë

Ò»¡¢µ¼ÈëÊý¾Ý
1¡¢È·¶¨
Êý¾Ý¿âĬÈϱàÂ룬±ÈÈç±àÂë
Ϊgbk,½«¶ÁÈë;¾¶±àÂëͬÑùÉèΪgbk£¬ÃüÁîΪ£º
           set names gbk;
2¡¢source
d:/20080613.sql µ¼ÈëÊý¾Ý¡£ÑéÖ¤
Êý¾Ý¿â
ÖеÄÊý¾ÝÊÇ·ñ´æÔÚÂÒÂë¡£
3¡¢Èç¹ûÈÔÈ»´æÔÚÂÒÂëÎÊÌ⣬Õâʱºò¾ÍÒª¿¼ÂǸı䵼ÈëÎļþµÄ±à ......

mysqlÖÐÈ¥³ýÖظ´Ï±£ÁôÒ»Ìì

query result(14 records)
id
uid
gid
1
11
502
2
107
502
3
100
503
4
110
501
5
112
501
6
104
502
7
100
502
8
100
501
9
102
501
10
104
502
11
100
502
12
100
501
13
102
501
14
110
501
µÚÆßÌõÓëµÚʮһÌõÖظ´µÈ
·½·¨Ò»
mysql> create temporary table tmp_wrap ......

Linux + JDK + Tomcat + MySQL + JDBC °²×°ÊÖ¼Ç

Linux + JDK + Tomcat + MySQL + JDBC °²×°ÊÖ¼Ç
Ò»¡¢Red Hat Linux
1.·ÖÇø
           
                        | swap  & ......

̸̸"Java¼Ü¹¹"

1. J2EEÊǹ淶£¬ÊÇÒ»ÖÖJSR±ê×¼£¬ÓÐÏêϸÎĵµ£¬²ûÊöJ2EEÌṩÄÄЩ¹¦ÄÜ£¬¿ÉÒÔÏÂÔØÕâÑùÎĵµ£¬µ±È»»¹ÓÐһЩ´úÂë½Ó¿Ú£¬ÕâÊǵäÐÍJavaÊÀ½çÖеĿò¼Ü´úÂë+±ê×¼ÎĵµÐÎʽ£¬ÕâÊÇÖ»ÓÐ×ÔÓÉÊÀ½ç²ÅÓеĹ淶£¬ÔÚ΢ÈíMSÊÀ½çÄãÊǾø¶Ô²»»á¿´µ½µÄ£¬ËùÒÔ£¬´Ó΢Èíת¹ýÀ´µÄ£¬»áÔΣ¬»á²»ÊÊÓ¦£¬²»ÄÜÔÙ°´ÕÕËûÃÇÒÔÇ°µÄ¾­ÑéÀ´¿´´ý×ÔÓɵÄÐÂÊÀ½ç¡£
2.¼Ü¹¹ÊǾ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ