java¿ª·¢ÖÐMysqlÖÐÎÄÂÒÂëÎÊÌâµÄ½â¾ö
MysqlÔÚĬÈÏÇé¿öϽ¨Á¢±íµÄ×Ö·û±àÂëÊÇlatin1£¬ËùÒÔÔÚ²åÈëÖÐÎÄʱ»á³ö´í¡£
eg£º
1¡¢²é¿´±í½¨Á¢µÄsqlÔ´Â룺
1: sqlÃüÁshow create table users
2:
3: ½á¹û£º
4: CREATE TABLE `users` (
5: `userID` int(10) unsigned NOT NULL AUTO_INCREMENT,
6: `userName` varchar(45) NOT NULL,
7: `password` varchar(45) NOT NULL,
8: PRIMARY KEY (`userID`)
9: ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=latin1
2¡¢²é¿´±íÖи÷ÁеÄÊôÐÔ£º
ÃüÁshow full columns from users
½á¹û£º
ÆäÖÐCollationÁбíʾ×Ö·û±àÂë¡£
½â¾ö·½·¨£º
Ò»¡¢ÐÞ¸ÄmysqlµÄÅäÖÃÎļþ£º
ÔÚmysqlµÄ°²×°Ä¿Â¼£¨C:\Program Files\MySQL\MySQL Server 5.1£©Ï£¬ÐÞ¸Ämy.ini¡£
²éÕÒdefault-character-setÊôÐÔ£¬½«Á½´¦¶¼¸ÄΪGBK¡£ÒÔºóÔÙ½¨±íʱ½«Ä¬ÈÏΪGBK±àÂ뷽ʽ¡£
ÐèÒªÖØÐÂÆô¶¯mysql·þÎñ¡£
¶þ¡¢Ð޸ıíµÄ×Ö·û±àÂëÊôÐÔ£º
ÃüÁalter table users CONVERT TO CHARACTER SET gbk
ÃüÁîÔËÐк󣬱íµÄÊôÐÔCHARSET=GBK£¬userNameºÍPasswordÁеÄCollationÊôÐÔ±äΪgbk_chinese_ci¡£
Èý¡¢ÐÞ¸ÄservletÖеĴúÂ룺
ÔÚservlet»ñÈ¡´«¹ýÀ´µÄ²ÎÊý֮ǰÉèÖñàÂ뷽ʽ£¬Èç:
request.setCharacterEncoding("gbk");
String msgTitle = request.getParameter("msgTitle");
String msgContent = request.getParameter("msgContent");
Ïà¹ØÎĵµ£º
·ÀÖ¹×¢ÈëµÄ¼¸ÖÖ°ì·¨
ÆäʵÔÀ´¾ÍÊÇÎÒÃÇÐèÒª¹ýÂËһЩÎÒÃdz£¼ûµÄ¹Ø¼ü×ֺͷûºÏÈ磺
Select£¬insert£¬update£¬delete£¬and£¬*£¬µÈµÈ
function inject_check($sql_str) {
return eregi('select|insert|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file
|outfile', $sql_str); & ......
MySqlÊý¾Ý¿âµÄÁÐÀàÐÍ£¨×Ö¶ÎÀàÐÍ)
MySQLÊý¾Ý¿âµÄ±íÊÇÒ»¸ö¶þά±í£¬ÓÉÒ»¸ö»ò¶à¸öÊý¾ÝÁй¹³É¡£
ÿ¸öÊý¾ÝÁж¼ÓÐËüµÄÌض¨ÀàÐÍ£¬¸ÃÀàÐ;ö¶¨ÁËMySQLÈçºÎ¿´´ý¸ÃÁÐÊý¾Ý£¬ÎÒÃÇ¿ÉÒÔ°ÑÕûÐÍÊýÖµ´æ·Åµ½×Ö·ûÀàÐ͵ÄÁÐÖУ¬MySQLÔò»á°ÑËü¿´³É×Ö·û´®À´´¦Àí¡£
MySQLÖеÄÁÐÀàÐÍÓÐÈýÖÖ£ºÊýÖµÀà¡¢×Ö·û´®ÀàºÍÈÕÆÚ/ʱ¼äÀà¡£
´Ó´óÀàÀ´¿´ÁÐÀàÐͺÍÊýÖ ......
1¡¢´´½¨mysqlÊý¾Ý¿âµÄ¹ÜÀíÓû§
Êý¾Ý¿â°²×°ºÃºó£¬ÎÒÃÇÓ¦¸ÃΪmysqlÊý¾Ý¿â´´½¨Ò»¸ö¹ÜÀíÕʺš£Òª°ÑrootÓû§ÉèÖÃΪ¹ÜÀíÔ±£¬´ËʱÐèÒªÖ´ÐÐÏÂÃæÃüÁ
[root@CDS2 bin]# /usr/bin/mysqladmin -u root password 123456
˵Ã÷£ºÉÏÃæ´´½¨µÄmysqlÊý¾Ý¿â¹ÜÀíԱΪroot£¬ÃÜÂë123456
2¡¢´´½¨Ò»°ãµÄÓû§
¹¤×÷ÖÐÓõ½web·þÎñÆ÷ºÍmysql·þÎñÆ ......
×î½üÔÚдjava²âÊÔ³ÌÐòµÄʱºòͻȻÓöµ½ÁËÒ»¸öÎÊÌ⣺javaĬÈÏ°üÖеÄpublicÀàÊDz»ÄÜÔÚÆäËû°üÖÐÖ±½Óµ÷ÓõÄ
Ê×ÏÈ£¬×ܽáÒ»ÏÂĬÈÏ°üÖÐÀàµÄʹÓ÷¶Î§£¬javaĬÈÏ°üÖеÄÀà¿ÉÒÔʵÀý»¯ÆäËü°üÖеÄpublicÀ࣬µ«ÊÇÆäËü°üÖеÄÀàÊDz»ÄÜÏÔʽʵÀý»¯Ä¬ÈÏ°üÖеÄÀàÕâ¸öÌØÐÔÔÚJDK1.4ÒÔºóµÄ°æ±¾³ÉÁ¢£»
& ......
ÔÚJavaÖУ¬²»Í¬µÄÀ඼ÓÐ×Ô¼ºµ¥¶ÀµÄCache»úÖÆ£¬ÊµÏֵķ½·¨Ò²¿ÉÄÜÓÐËù²»Í¬£¬ÎÄÕÂÁоÙÁËJavaÖг£¼ûµÄ¸÷ÀàCache»úÖƵÄʵÏÖ·½·¨£¬Í¬Ê±½øÐÐÁË×ۺϵıȽϡ£
OSCache
OSCacheÊǸöÒ»¸ö¹ã·º²ÉÓõĸßÐÔÄܵÄJava EE»º´æ¿ò¼Ü£¬OSCacheÄÜÓÃÓÚÈκÎJavaÓ¦ÓóÌÐòµÄÆÕͨµÄ»º´æ½â¾ö·½°¸¡£
OSCacheÓÐÒÔÏÂÌص㣺»º´æÈκζÔÏó£¬Äã¿ÉÒÔ²»ÊÜÏÞÖƵ ......