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

MySQLÓëJSP ÂÒÂëÎÊÌâ½â¾ö

ÂÒÂëÕæÊǸöÁîÈËÌÖÑáµÄÎÊÌâ~
¸Õ²ÅÖÕÓÚ°ÑMySQLÓëJSP½»»¥µÄÂÒÂëÎÊÌâ½â¾öÁË¡£
°ì·¨ÈçÏ£º
1.ÔÚurl´¦¼ÓÉϾä×Ó "&useUnicode=true&characterEncoding=GBK" £»
2.ÎÒÓÃNavicat Lite¿ÉÊÓ»¯¹¤¾ß´´½¨MySQLÊý¾Ý¿âʱ£¬¿ÉÑ¡¶¨Êý¾Ý¿â±àÂ룬ҲÊÇ GBK £»
3.Ò³ÃæµÄ±àÂë¿ÉÒÔÑ¡GBKÒÔÍâµÄ±àÂ뷽ʽ£¬ÈçUTF-8¡£Èô²Ù×÷Ò³ÃæµÄ±àÂëÊÇUTF-8£¬Ôò²Ù×÷Ò³ÃæÉÏÒªÒ»¾ärequest.setCharacterEncoding("UTF-8");
   »òÕß´óÕУ¬±ÈÈçnew String(name.getBytes("ISO-8859-1"),"UTF-8");   ÎÒϲ»¶µÚÒ»ÖÖ¡£
¸½ÉÏÀý×ÓÒ»¸ö£º
//JSP²åÈëÊý¾Ýµ½Êý¾Ý¿â------------------------------
ǰ̨ÏÔʾҳÃæ----------------------------------------------------------------------
<div align="center">
<form action="data/InsertHandle.jsp" method="post">
ͼÊéÃû³Æ£º<input type="text" name="name" /><br>
³ö°æÉ磺   <input type="text" name="publisher" /><br>
ͼÊé¼Û¸ñ£º<input type="text" name="price" /><br>
<input type="submit" value="Ìá½»">
</form>
</div>
Êý¾Ý²åÈëµÄ²Ù×÷Ò³Ãæ---------------------------------------------------------------
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'InsertHandle.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">


Ïà¹ØÎĵµ£º

×Ô¼ºÈçºÎÕýÈ·»ñÈ¡MYSQLµÄADOÁ¬½Ó×Ö·û´®

ÔÚ×ÀÃæÉÏн¨Ò»¸ö¿ÕµÄÎı¾Îļþmysql.txt,ÖØÃüÃûΪmysql.udl,Ë«»÷Õâ¸ömysql.udlÎļþ£¬´ò¿ª“Êý¾Ý¿âÁ¬½ÓÊôÐÔ”¶Ô»°¿ò£¬ÔÚ“Ìṩ³ÌÐò”ҳѡÔñ”Micrsoft Ole DB Provider for ODBC Drivers“£¬ µã»÷ÏÂÒ»²½£¬ÔÚ“Á¬½Ó”Ò³µÄ,"Ö¸¶¨Êý¾ÝÔ´"Ñ¡Ôñ"ʹÓÃÁ¬½Ó×Ö·û´®",µã» ......

Mysql Error #2002: Can't connect to local

ÔÚSentOS 5ÖУº
>>yum install mysql
°²×°Íê±Ïºó£¬
>>mysql
error:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'(2)";
½ñÌì·þÎñÆ÷Óöµ½ÁËÒ»¸öºÜÊìϤµÄÎÊÌâ
ÊäÈë
#mysql -u root -p
 
ERROR 2002 (HY000):Can't connect to local MySQL server
 
  ......

mysqlÖÐÎÄÅÅÐò

UTF8 ĬÈÏУ¶Ô¼¯ÊÇ utf8_general_ci , Ëü²»ÊÇ°´ÕÕÖÐÎÄÀ´µÄ¡£ÄãÐèҪǿÖÆÈÃMySQL°´ÖÐÎÄÀ´ÅÅÐò¡£
select

*

from
core_vender_info
order

by

convert
(vender_abbrev USING gbk) COLLATE gbk_chinese_ci
......

MysqlʹÓÃ×ܽá

      ±ÏÒµÉè¼ÆµÄ³ÌÐòÖ÷Ìå±àºÃÁË£¬ÔËÐÐÉÙÁ¿Êý¾ÝûÓÐÈκÎÎÊÌ⣬һµ©Êý¾ÝÁ¿Ôö¼Óµ½22w£¬ÔËÐÐʱ¼ä¾Í³¤µÃÁîÈË·¢Ö¸¡£µ¼Ê¦½¨Ò飬³ÌÐòÖо¡¿ÉÄܵؼõÉÙÓëÊý¾Ý¿â½»»¥µÄ´ÎÊý£¬¾¡¿ÉÄܵذѹ¤×÷¶ª¸øÊý¾Ý¿âÍê³É¡£ÔÚÕâһ˼ÏëµÄÖ¸µ¼Ï£¬ÎÒÈýÌì´ó·ùÐ޸ijÌÐò£¬²¿·Ö´úÂ뼸ºõÊÇ·­ÐÂÁËÒ»±é¡£×ܵÄÀ´Ëµ£¬ÔËÐÐʱ¼äȷʵµÃµ½ÁË ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ