ITPub博客

首页 > 数据库 > 数据库开发技术 > JDBC Driver连接方法列表

JDBC Driver连接方法列表

原创 数据库开发技术 作者:bluefishyong 时间:2007-10-08 14:44:24 0 删除 编辑
JDBC Driver连接方法列表[@more@]有鑒於許多版友對於尋找JDBC driver或者如何使用driver常常發問,
在這邊我簡單整理一下比較代表性的driver跟使用方式.

Microsoft SQL Server series (6.5, 7.x and 2000) and Sybase 10

JDBC Name: jTDS
URL: http://jtds.sourceforge.net/
Version: 0.5.1
Download URL: http://sourceforge.net/project/showfiles.php?group_id=33291

語法:


Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://host:port/database","user","password");

or

Connection con = DriverManager.getConnection("jdbc:jtds:sybase://host:port/database","user","password");


MySQL

JDBC Name: Connector/J 3.0
URL: http://www.mysql.com/
Version: 3.0.8-stable
Download URL: http://www.mysql.com/downloads/api-jdbc-stable.html

語法:


Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://host:port/database","user","password");


Oracle

JDBC Name: Connector/J 3.0
URL: http://otn.oracle.com/
Version: 3.0.8-stable
Download URL: http://otn.oracle.com/software/tech/java/sqlj_jdbc/content.html

語法:


Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@host:port:databse","user","password");


Sybase

Driver: jConnect 4.5/5.5 (JDBC 2.0 請使用5.5)

語法:


Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
Connection con = DriverManager.getConnection("jdbc:sybase:Tds:[IP位址或機器名稱]:2638?ServiceName=資料庫名稱","帳號","密碼");


Postgresql

JDBC Name: PostgreSQL JDBC
URL: http://jdbc.postgresql.org/
Version: 7.3.3 build 110
Download URL: http://jdbc.postgresql.org/download.html

語法:


Class.forName("org.postgresql.Driver");
Connection con=DriverManager.getConnection("jdbc:postgresql://host:port/database","user","password");


Informix

Driver:com.informix.jdbc.IfxDriver

語法:


Class.forName("com.informix.jdbc.IfxDriver");
String full_db="jdbc:informix-sqli://10.14.86.11:300/authority: INFORMIXSERVER=ifx9;user=informix;password=informix;NEWLOCALE=en_us,zh_tw;NEWCODESET=Big5,8859-1,819;";
con =DriverManager.getConnection(full_db);


IBM AS400主機在用的JDBC語法

有裝V4R4以上版本的Client Access Express
可以在C:Program FilesIBMClient Accessjt400lib
找到 driver 檔案 jt400.zip,並更改副檔名成為 jt400.jar

語法


java.sql.DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
Class.forName("com.ibm.as400.access.AS400JDBCConnection");
con = DriverManager.getConnection("jdbc:as400://IP","user","password");

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8046846/viewspace-975094/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    18
  • 访问量
    15493