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

ÅäÖÃtomcat5.5 jndi ¸÷ÖÖÅäÖ÷½Ê½ ·ÖÎö×ܽᣨmysql£©

×¼±¸¹¤×÷£º
°²×°tomcat5.5£¨×¢ÒâÕâµã£©
°²×°mysql
¿½±´mysqlÇý¶¯µ½tomcat_home/common/libÏÂ
н¨Ò»¸öweb¹¤³Ì
ÔÚ¹¤³ÌÖмÓÈëindex.jsp
<%@page import="java.util.*,javax.naming.*,java.sql.*,javax.sql.*" %>
<%@page contentType="text/html;charset=BIG5"%>
<%    
    Context ctx = new InitialContext();      
    String strLookup = "java:comp/env/jdbc/test"; 
    DataSource ds =(DataSource) ctx.lookup(strLookup);
    Connection con = ds.getConnection();
    if (con != null){
        out.print("success");
    }else{
        out.print("failure");
    }       
%>
web.xmlÖмÓÈë
<resource-ref>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
ÅäÖÃtomcat
ÕâÒ»²½µÄÄ¿µÄ¾ÍÊǸæËßtomcatÈçºÎÁ¬½ÓÊý¾Ý¿â
¿ÉÒÔ·ÖΪÁ½ÖÖ´óµÄÀàÐÍ£¬Ã¿ÖÖÀàÐÍÓÖÓкܶàÖÖÅäÖ÷½Ê½
ÅäÖÃÀàÐÍÒ»£»
(Ö±½ÓÅäÖõÄÀàÐÍ£¬ÕâÖÖ·½Ê½×î¼òµ¥)
·½·¨Ò»£º
Ö±½ÓÔÚtomcat_home/conf/localhost/Ͻ¨Á¢Ò»¸öxmlÎļþ£¬ÎļþÃûÊÇ<yourAppName>.xml
ÀýÈçÎҵŤ³ÌÃû½Ðjndi£¬¶ÔÓ¦µÄÃû×Ö½Ðjdni.xml
ÄÚÈÝÈçÏÂ:
<Context>
 <Resource
          name="jdbc/test"
          type="javax.sql.DataSource"
          password="bb"
         &nb


Ïà¹ØÎĵµ£º

Mysql ³£Óú¯Êý


 
Mysql ³£Óú¯Êý
ASCII(str) 
¡¡·µ»Ø×Ö·û´®strµÄµÚÒ»¸ö×Ö·ûµÄASCIIÖµ(strÊÇ¿Õ´®Ê±·µ»Ø0) 
mysql> select ASCII('2'); 
¡¡¡¡-> 50 
mysql> select ASCII(2); 
¡¡¡¡-> 50 
mysql> select ASCII('dete'); 
¡¡¡¡- ......

Á˽âÊý¾Ý´æ´¢mysql¶Ô²âÊÔµÄÖúÒæ

¹ýÈ¥µÄÒ»¸öÔ£¬ÎҵŤ×÷ÖØÐĶ¼ÔںϷþÄ£¿éµÄ²âÊÔ¡£ÆÄÓÐһЩÊÕ»ñ¡£
´Ë´Î´óÁ¿ºÍmysql´ò½»µÀ£¬¶Ô²úÆ·µÄÊý¾Ý´æ´¢ÓÐÁ˱ȽÏÈ«ÃæµÄÕÆÎÕ¡£²¢´ÙʹºÍÖ´ÐÐÁËdbµÄ±í½á¹¹ºÍÊôÐԵļì²é¡£ºÏ·þͶ·Åºó£¬ÔÝδ·¢ÏÖÒò´íÎóÊý¾Ýµ¼ÖµÄbug»òʹʡ£
²¢ÔÚ²âÊÔ³õÆھ͹Ø×¢ºÍ¼ì²âÐÔÄÜÖ¸±ê£¬´Ùʹ³ÌÐò×öÁËÒ»´ÎÐÔÄܲâÊÔ£»¶ÔͶ·ÅʱµÄ·çÏÕÔöÇ¿ÁËÔ¤·ÀºÍ¿ØÖÆ¡£ ......

MySQLÖÐÐÞ¸ÄÃÜÂë¼°·ÃÎÊÏÞÖÆÉèÖÃÏê½â

¡¡MySQLÊÇÒ»¸öÕæÕýµÄ¶àÓû§¡¢¶àÏß³ÌSQLÊý¾Ý¿â·þÎñÆ÷¡£MySQLÊÇÒÔÒ»¸ö¿Í»§»ú/·þÎñÆ÷½á¹¹µÄʵÏÖ£¬ËüÓÉÒ»¸ö·þÎñÆ÷ÊØ»¤³ÌÐòmysqldºÍºÜ¶à²»Í¬µÄ¿Í»§³ÌÐòºÍ¿â×é³É¡£ÓÉÓÚÆäÔ´ÂëµÄ¿ª·ÅÐÔ¼°Îȶ¨ÐÔ£¬ÇÒÓëÍøÕ¾Á÷ÐÐ±à »ÓïÑ PHPµÄÍêÃÀ½áºÏ£¬ÏÖÔںܶàÕ¾µã¶¼ÀûÓÃÆäµ±×÷ºó¶ËÊý¾Ý¿â£¬Ê¹Æä»ñµÃÁ˹㷺ӦÓᣴ¦ÓÚ°²È«·½ÃæµÄ¿¼ÂÇ£¬ÐèҪΪÿһÓû§¸ ......

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

javaÓëmysqlÂÒÂëµÄÎÊÌâ
javaÓëmysqlÂÒÂëµÄÎÊÌâ
¹Ø¼ü×Ö: javaÓëmysqlÂÒÂëµÄÎÊÌâ
½â¾ö·½·¨Ò»:(×îÖØÒªµÄÒ»ÖÖ·½·¨)
Äã¿´ÏÂmy.ini£¬ÓÐÎÞ
[mysql]
default-character-set=utf8
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
È»ºó½¨Á¢±íʱ£¬Ò²ÒªÓ㨱ÈÈ磩
DROP TABLE IF ......

wampÈçºÎÐÞ¸ÄmysqlĬÈÏ¿ÕÃÜÂë


cmdÏÂÇл»µ½ mysql °²×°Ä¿Â¼
Àý
d:/mysql/bin
  
(Èç¹ûÓÃWAMP°²×°ÔòÊÇD:\wamp\bin\mysql\mysql5.1.30\bin)
Ç°Ì᣺mysqlÓû§rootÃÜÂëΪ¿Õ.
Êä
Èë mysql -u root mysql
mysql> ״̬ÏÂÊäÈë 
 update user set password=password('ÐÂÃÜÂë') where user='root';
ȯ
ÏÔ   
Quer ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ