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

java£¨jsp)ʹÓÃMySqlÊý¾Ý¿â,ÖÐÎÄÂÒÂëµÄÍêÕû½â¾ö·½°¸

 java£¨jsp)ʹÓÃMySqlÊý¾Ý¿â,ÖÐÎÄÂÒÂëµÄÍêÕû½â¾ö·½°¸
mysqlÊÇÒ»¸öСÐ͵ĿªÔ´µÄÊý¾Ý¿â£¬ÓÃÀ´×ÔѧһЩ¼¼ÊõÊÇÊ®·Ö·½±ãµÄ¡£µ«Ê¹ÓÃmysql´æ´¢Êý¾Ý£¬Ò²»áÓöµ½Ò»Ð©·Ç³£¶ñÐĵÄÎÊÌ⣬È磺ÖÐÎÄÂÒÂëÎÊÌâ¡¢javaÇý¶¯³ÌÐòÎÞ·¨Ê¹ÓõÄÎÊÌ⣨ÒѾ­½â¾ö£¬Ïê¼û£ºhttp://hi.baidu.com/lauo1988/blog/item/ff0da655bd3e2eceb745ae0b.html)¡£
¶ÔÓÚÖÐÎÄÂÒÂëÎÊÌâ¡£ÍøÉÏËÑË÷µÃµ½µÄ½â¾ö·½°¸±È½Ï¶à£¬Ö÷Òª»¹ÊÇÉèÖÃmySqlµÄÅäÖÃÎļþ¡£ÕâЩ¶¼±È½ÏÂé·³£¬µ«ÊÇÉèÖóɹ¦µÄ»°£¬µÄÈ·Äܹ»Ò»ÀÍÓÀÒÝ¡£µ«ÎÒ³¢ÊÔÁ˺ܶà´ÎÍøÉϵķ½·¨£¬¶¼²»ÄܺܺõĽâ¾öÕâ¸öÎÊÌâ¡£ÂÒÂëÒÀÈ»´æÔÚ¡£ÏëÏ룬Ҫ×öÍøÕ¾µÄ»°£¬ÓÃmySqlÊý¾Ý¿â´æ·ÅÊý¾Ý£¬ÖÐÎĶ¼²»ÄܺܺÃÖ§³ÖµÄ»°£¬×öÕⶫÎ÷ÊÇûÓÐÓõģ¡
×îÖÕ£¬ÎÒ°´ÕÕ£º½«ÖÐÎÄ×Ö×Ö·û´®£¬°´ÕÕÎÞËð±àÂëµÄ·½Ê½£¬¶ÔÆä½øÐбàÂ룬ȻºóÖ±½Ó´æÓÚÊý¾Ý¿âÖС£µ±ÒªÈ¡³öÊý¾Ýʱ£¬ÔÙ½«ÖÐÎÄ×Ö·û´®½âÂë¡£ÕâÑù¿ÉÒÔ´ïµ½´æ´¢ÖÐÎÄ×Ö·û´®£¬ÓÖ²»»á²úÉúÂÒÂëµÄÄ¿±ê¡£
ÎÒÔÚÍøÉÏÕÒµ½ÁËһЩÎÞËð±àÂëµÄ·½Ê½£¬Ïê¼û£ºhttp://www.cnblogs.com/qiren5761/articles/523790.html
ÎÒ²ÉÓÃÁËÀïÃæµÄ£º“String£­GBK¡µByteArray£­ISO-8859-1¡µString£­ISO-8859-1¡µByteArray£­GBK¡µString
”µÄ±àÂë/½âÂ뷽ʽ¡£
Ö÷ÒªµÄjava´¦Àíº¯ÊýÈçÏ£º
/*
*Íê³É´Ógbk±àÂëµ½ISO-8859-1µÄת»»
*/
public static
String encode(String str)
{
   if(str==null||str.equals("")) return
str;
   try
   {
    return new
String(str.getBytes("gbk"),"ISO-8859-1");
   }
   catch(Exception e){
e.printStackTrace(); return str;}
}
/*
*´ÓISO-8859-1»Ö¸´gbk±àÂë
*/
public static String
decode(String str)
{
   if(str==null||str.equals("")) return str;
  
try
   {
    return new String(str.getBytes("ISO-8859-1"),"gbk");
  
}
   catch(Exception e){ e.printStackTrace(); return
str;}
}
µ±È»£¬¶ÔÓÚsql²Ù×÷£¬²»¹ÜÊDzåÈ뻹ÊDzéѯ£¬sqlÓï¾ä±ØÐèÏȾ­¹ýencodeº¯Êý±àÂ룬ȻºóµÃµ½µÄ²éѯ½á¹ûʹÓÃdecode£¬¿ÉÒÔ»Ö¸´µ½ÐèÒªµÄÖÐÎÄ×Ö´®¡£¾ÙÀýÈçÏ£º
/*
*»ñµÃÓû§µÄÃèÊöÐÅÏ¢
*/
public String[]
getUserInfo(String uid)
{
   if(uid==null||uid.equals("")) return
null;
   try
   {


Ïà¹ØÎĵµ£º

javaÈëÃÅ

 Javaѧϰ´ÓÈëÃŵ½¾«Í¨ 
Ò»¡¢ JDK (Java Development Kit) 
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......

JavaÐÂÊÖÈëÃźÜÖØÒªµÄ¼¸¸ö»ù±¾¸ÅÄî


¡¡finalÀࣺΪ·ÀÖ¹ËûÈË´ÓÄãµÄÀàÉÏÅÉÉúÐÂÀ࣬´ËÀàÊDz»¿ÉÀ©Õ¹µÄ¡£
¡¡¡¡¶¯Ì¬µ÷ÓñȾ²Ì¬µ÷Óû¨·ÑµÄʱ¼äÒª³¤¡£
¡¡¡¡³éÏóÀࣺ¹æ¶¨Ò»¸ö»ò¶à¸ö³éÏó·½·¨µÄÀà±¾Éí±ØÐ붨ÒåΪabstract¡£
¡¡¡¡Àý£º public abstract string getDescripition
¡¡¡¡JavaÖеÄÿһ¸öÀ඼ÊÇ´ÓObjectÀàÀ©Õ¹¶øÀ´µÄ¡£
¡¡¡¡objectÀàÖеÄequalºÍtoString·½·¨¡ ......

Á½ÖÖת»»mysqlÊý¾Ý±àÂëµÄ·½·¨

±³¾°£ºÄ³¸öϵͳµÄmysqlÊý¾Ý¿âdnname²ÉÓÃĬÈϵÄlatin1×Ö·û¼¯£¬ÏµÍ³Éý¼¶ÐèÒª½«ËùÓÐÊý¾Ýת»»³Éutf-8¸ñʽ£¬Ä¿±êÊý¾Ý¿âΪnewdbname(½¨¿âʱʹÓÃutf8)
·½·¨Ò»£º
²½ÖèÒ» ÃüÁîÐÐÖ´ÐУºmysqldump --opt -hlocalhost -uroot -p*** --default-character-set=lantin1 dbname > /usr/local/dbname.sql
²½Öè¶þ ½« dbname.s ......

.\mysql\user is marked as crashed ½â¾ö°ì·¨

 
I found a solution to anyone else who may be having this problem.
First start mysql using skip grant tables
root@ns1 [/var/lib/mysql/mysql]# service mysql start --skip-grant-tables
Starting MySQL [ OK ]
now with mysql started, you can repair the mysql/user table
root@ns1 [/var/lib/mysql ......

ÓÃjavaÁ¬½ÓMySqlÊý¾Ý¿â

 Ò»¸ö¼òµ¥Ê¾Àý--
1£¬×¼±¸£ºMySQLÊý¾Ý¿âÇý¶¯°ü¡¾mysql-connector-java-5.1.10-bin.jar¡¿µ¼Èë
2£¬´´½¨²âÊÔÁ¬½ÓÖ÷³ÌÐò
package mysqlConnection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class JdbcDemo {
public static void main(String[] args) {
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ