- 爱易网页
 
                        - 
                            数据库教程
 
                        - java联接各种数据库 
 
                         
                    
                    
                    日期:2014-05-16  浏览次数:20599 次 
                    
                        
                         java连接各种数据库
    
- 再用光在博客找就行了,呵呵
 
 
- 1、Oracle8/8i/9i数据库(thin模式) ??
 
- ??
 
- 
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); ??
 
- ??
 
- 
String?url="jdbc:oracle:thin:@localhost:1521:orcl"; ??
 
- ??
 
- 
??
 
- ??
 
- 
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"; ??
 
- ??
 
- 
??
 
- ??
 
- 
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"; ??
 
- ??
 
- 
??
 
- ??
 
- 
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"
 
 
                     
                    
                    
                        免责声明: 本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。