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

tomcatÁ¬½Ó³ØµÄÅäÖà Java¿ª·¢¼°±à³Ì˼Ïë


<Resource name="jdbc/testDB" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/testDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:microsoft:sqlserver://218.246.85.65:1433;DatabaseName=ZCMIS</v
alue>
</parameter>
<parameter>
<name>username</name>
<value>sa</value>
</parameter>
<parameter>
<name>password</name>
<value>sa</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>30</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>1000</value>
</parameter>
</ResourceParams>
°ÑÏÂÃæµÄ¶«Î÷¼Óµ½web.xmlÖÐ
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/testDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
ÀàµÄÄÚ²¿ÊµÏÖ
try{
Context initCtx = new InitialContext();
Context ctx = (Context) initCtx.lookup("java:comp/env");
//»ñÈ¡Á¬½Ó³Ø¶ÔÏó
Object obj = (Object) ctx.lookup("jdbc/testDB");
javax.sql.DataSource ds = (javax.sql.DataSource)obj;
Connection conn = ds.getConnection();
}
catch(Exception e)
{
System.out.print(e.toString());
}


Ïà¹ØÎĵµ£º

JAVAѧϰ˳Ðò

Java·¢Õ¹µ½ÏÖÔÚ£¬°´Ó¦ÓÃÀ´·ÖÖ÷Òª·ÖΪÈý´ó¿é£ºJ2SE,J2MEºÍJ2EE¡£ÕâÈý¿éÏ໥²¹³ä£¬Ó¦Ó÷¶Î§²»Í¬¡£
J2SE¾ÍÊÇJava2µÄ±ê×¼°æ£¬Ö÷ÒªÓÃÓÚ×ÀÃæÓ¦ÓÃÈí¼þµÄ±à³Ì£»
J2MEÖ÷ÒªÓ¦ÓÃÓÚǶÈëÊÇϵͳ¿ª·¢£¬ÈçÊÖ»úºÍPDAµÄ±à³Ì£»
J2EEÊÇJava2µÄÆóÒµ°æ£¬Ö÷ÒªÓÃÓÚ·Ö²¼Ê½µÄÍøÂç³ÌÐòµÄ¿ª·¢£¬Èçµç×ÓÉÌÎñÍøÕ¾ºÍERPϵͳ¡£
ÏÈѧϰj2se
Ҫѧϰj2ee¾ÍÒ ......

Java´ÓÈëÃŵ½¾«Í¨µÄѧϰ¹ý³Ì

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

java ·¾¶ÖеĿոñÎÊÌâ

Èô·¾¶Öдø¿Õ¸ñ£¬Ôò
1. uri.getpath();·µ»ØµÄ·¾¶ÖеĿոñÈÔÒÔ“¿Õ¸ñ”µÄÐÎʽ³öÏÖ£¬Èç/F:/MyEclipse Workspace/project/bin/...
³ý´ËÖ®Í⣬URL·µ»ØµÄÒ»Çз¾¶ÖеĿոñ¶¼ÒÔ“%20”µÄÐÎʽ³öÏÖ£¬uri.toString()Ò²ÒÔ“%20”µÄÐÎʽ³öÏÖ¡£
2. new File(String filePath);½ÓÊÜÕýÈ·URI¸ñʽµÄ²ÎÊýº ......

[ת]javaÖÐbyteת»»intʱΪºÎÓë0xff½øÐÐÓëÔËËã

ÔÚÆÊÎö¸ÃÎÊÌâÇ°Çë¿´ÈçÏ´úÂë
public static String bytes2HexString(byte[] b) {
  String ret = "";
  for (int i = 0; i < b.length; i++) {
   String hex = Integer.toHexString(b[ i ] & 0xFF);
   if (hex.length() == 1) {
    hex = '0' ......

java ·´Éä»úÖÆ ——С½á

1£©Õý³£Çé¿öÏÂÎÒÃÇ¿ÉÒÔͨ¹ýÀàʵÀý»¯Ò»¸ö¶ÔÏó£¬ÄÇôͨ¹ý·´Éäʵ¼ÊÉϾͿÉÒÔͨ¹ýÒ»¸ö¶ÔÏóµÃµ½´ËÀàÍêÕûµÄ°ü.ÀàÃû³Æ
JAVA·´Éä»úÖÆÊÇÔÚÔËÐÐ״̬ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬¶¼Äܹ»ÖªµÀÕâ¸öÀàµÄËùÓÐÊôÐԺͷ½·¨£»¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏ󣬶¼Äܹ»µ÷ÓÃËüµÄÈÎÒâÒ»¸ö·½·¨£»ÕâÖÖ¶¯Ì¬»ñÈ¡µÄÐÅÏ¢ÒÔ¼°¶¯Ì¬µ÷ÓöÔÏóµÄ·½·¨µÄ¹¦ÄܳÆΪjavaÓïÑԵķ´Éä»úÖÆ¡£
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ