³£¼ûjavaÊý¾Ý¿âÁ¬½Ó´úÂë
1¡¢Oracle8/8i/9iÊý¾Ý¿â£¨thinģʽ£©
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl";
//orclΪÊý¾Ý¿âµÄSID
String user="test";
String password="test";
Connection conn= DriverManager.getConnection(url,user,password);
2¡¢DB2Êý¾Ý¿â
Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();
String url="jdbc:db2://localhost:5000/sample";
//sampleΪÄãµÄÊý¾Ý¿âÃû
String user="admin";
String password="";
Connection conn= DriverManager.getConnection(url,user,password);
3¡¢Sql Server7.0/2000Êý¾Ý¿â
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb";
//mydbΪÊý¾Ý¿â
String user="sa";
String password="";
Connection conn= DriverManager.getConnection(url,user,password);
4¡¢SybaseÊý¾Ý¿â
Class.forName("com.sybase.jdbc.SybDriver").newInstance();
String url =" jdbc:sybase:Tds:localhost:5007/myDB";
//myDBΪÄãµÄÊý¾Ý¿âÃû
Properties sysProps = System.getProperties();
SysProps.put("user","userid");
SysProps.put("password","user_password");
Connection conn= DriverManager.getConnection(url, SysProps);
5¡¢InformixÊý¾Ý¿â
Class.forName("com.informix.jdbc.IfxDriver").newInstance();
String url =
"jdbc:informix-sqli://123.45.67.89:1533/myDB:INFORMIXSERVER=myserver;
user=testuser;password=testpassword";
//myDBΪÊý¾Ý¿âÃû
Connection conn= DriverManager.getConnection(url);
6¡¢MySQLÊý¾Ý¿â
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/myDB?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
//myDBΪÊý¾Ý¿âÃû
Connection conn= DriverManager.getConnection(url);
7¡¢PostgreSQLÊý¾Ý¿â
Class.forName("org.postgresql.Driver").newInstance();
String url ="jdbc:postgresql://localhost/myDB"
//myDBΪÊý¾Ý¿âÃû
String user="myuser";
String password="mypassword";
Connection conn= DriverManager
Ïà¹ØÎĵµ£º
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
JAVAÅÅÐò»ã×Ü ÊÕ²Ø
package com.softeem.jbs.lesson4;
import java.util.Random;
/**
* ÅÅÐò²âÊÔÀà
*
* ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º
* 1.²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©£»
* 2.½»»»ÅÅÐò£¨Ã°ÅÝÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©£»
* 3.Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£ ......
http://blog.csdn.net/gztoby/archive/2004/11/11/176737.aspx
1.
Ó¦Ó÷¶Î§
±¾¹æ·¶Ó¦ÓÃÓÚ²ÉÓÃ
J2EE
¹æ·¶µÄÏîÄ¿ÖУ¬ËùÓÐÏîÄ¿ÖеÄ
JAVA
´úÂ루º¬
JSP
£¬
SERVLET
£¬
JAVABEAN
£¬
EJB
£©¾ùÓ¦×ñÊØÕâ¸ö¹æ·¶¡£Í¬Ê±£¬Ò²¿É×÷ΪÆäËüÏîÄ¿µÄ²Î¿¼¡£
2.
Éè¼ÆÀàºÍ·½·¨
2.1
´´½¨¾ßÓкÜÇ¿ ......
javaÖÐËùÓж¼ÊÇunicodeµÄ±àÂ룬¿ÖÅ´ó¼Ò¶¼Çå³þ£¬µ«ÊÇÕâ¾ßÌåÊÇÄÄÀïµÄ±àÂë¡£ÔÚһ̨ÖÐÎÄwindows²Ù×÷ϵͳ£¨GBK£©£¬»òÓ¢ÎĵÄlinux²Ù×÷ϵͳÏ£¨ISO-8859-1£©Ï£¬ÕâЩ±àÂëÊÇÈçºÎת»»µÄ¡£JAVAÖеÄStringÀàµÄgetBytes()·½·¨ºÍStringÀàµÄÖ¸¶¨±àÂ뷽ʽµÄ¹¹Ô캯ÊýÖеıàÂëÓÖÊÇÈçºÎÄØ£¿
ÕâÀïÎÒ²»×öÉîÈë½âÊÍ£¬Ö»ÊÇչʾһÏÂÕâЩ±àÂë ......
public class Test2 {
public static void main(String[] args) {
// ¼òµ¥ÈÏʶÕýÔò±í´ïʽµÄ¸ÅÄî
/*
* p("abc".matches("...")); p("a8729a".replaceAll("\\d", "-")); Pattern
* p = Pattern.compile("[a-z]{3}"); Matcher m = p.match ......