eclipse连接数据库驱动汇总

eclipse开发数据之前的第一步首先是测试数据库连线是否正常,而在测试之前需要事先下载数据库驱动,不同的数据库需要选择相应的数据库驱动

 

Microsoft SQL Server (6.5, 7, 2000and 2005) and Sybase (10, 11, 12).  

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

DBC Name: JTDS 

Home Page: http://jtds.sourceforge.net/ 

JDBC Ver: 1.0.2 

Download: http://sourceforge.net/projects/jtds/files/jtds/1.2.5/jtds-1.2.5-src.zip/download

Conn Code: 

  Class.forName("net.sourceforge.jtds.jdbc.Driver "); 

   Connectioncon =DriverManager.getConnection("jdbc:jtds:sqlserver://host:port/database","user","password"); 

or 

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

 

Microsoft SQL Server 2000 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

JDBC Name: SQL Server 2000 Driver for JDBC 

Home Page: http://www.microsoft.com/china/sql/ 

JDBC Ver: (SQL Server 2000 Driver for JDBC) 

Download: http://www.microsoft.com/china/sql/downloads/2000/jdbc.asp 

Conn Code: 

  Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");  

   Connectionconn = DriverManager.getConnection("jdbc:microsoft:sqlserver://server1:1433","user","password"); 

 

Oracle 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

JDBC Name: Connector/J  

Home Page: http://www.oracle.com/technology/software/tech/java/ 

JDBC Ver: (based on Oracle) 

Download: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/ 

Conn Code: 

  Class.forName("oracle.jdbc.driver.OracleDriver"); 

   Connectioncon =DriverManager.getConnection("jdbc:oracle:thin:@host:port:databse","user","password"); 

 

MySQL 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

JDBC Name: Connector/J 

Home Page: http://dev.mysql.com/ 

JDBC Ver: 3.1 

Download: http://dev.mysql.com/downloads/ 

Conn Code: 

  Class.forName("com.mysql.jdbc.Driver"); 

   Connectioncon =DriverManager.getConnection("jdbc:mysql://host:port/database","user","password"); 

 

Sybase 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

JDBC Name: jConnect  

Home Page: http://www.sybase.com.cn/cn/content/SDN/ 

JDBC Ver: 4.5/5.5 

Download: http://www.sybase.com/detail_list?id=13&morenavId=8668&multi=true&SR=Y&show=1265

Conn Code: 

Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance(); 

DriverManager.getConnection("jdbc:sybase:Tds:IP:2638?ServiceName="+database,"user","password"); 

 

Postgresql 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

JDBC Name: PostgreSQL JDBC 

Home Page: http://jdbc.postgresql.org/ 

JDBC Ver: 8.0 Build 310 

Download: http://jdbc.postgresql.org/download.html 

Conn Code: 

  Class.forName("org.postgresql.Driver");  

   Connectioncon =DriverManager.getConnection("jdbc:postgresql://host:port/database","user","password"); 

 

IBM Informix 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

JDBC Name: Informix JDBC Driver (IBM Informix JDBC V3.0) 

Home Page: http://www-306.ibm.com/software/data/informix/ 

JDBC Ver: 3.0.JC1 

Download: http://www14.software.ibm.com/webapp/download/search.jsp?go=y&rs=ifxjdbc 

Conn Code: 

  Class.forName("com.informix.jdbc.IfxDriver").newInstance();  

   Connectionconn=DriverManager.getConnection("jdbc:informix-sqli://123.45.67.89:1533/myDB:INFORMIXSERVER=myserver;user=testuser;password=testpassword";); 

 

IBM DB2 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

JDBC Name: DB2 JDBC Universal Driver 

Home Page: http://www-306.ibm.com/software/data/db2/udb/  

JDBC Ver:  

Download: http://www-128.ibm.com/developerworks/db2/downloads/jcc/ 

Conn Code: 

  Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();  

   Connectionconn=DriverManager.getConnection("jdbc:db2://localhost:5000/sample",user,password);  

 

IBM AS400主机在用的JDBC语法 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

  有装V4R4以上版本的Client Access Express 

  可以在C:"ProgramFiles"IBM"Client Access"jt400"lib 

  找到 driver 档案 jt400.zip,并更改扩展名成为 jt400.jar 

Conn Code: 

  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");  

 

   Db Name:Ms Access or Ms Foxpro 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

Conn Code: 

   step 1: 配置 odbc (例如:myDb) 

   step 2:  

   StringdbURL = "jdbc:odbc:myDb"; 

  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 

Connection conn =DriverManager.getConnection(dbURL);  

or 

   StringdbURL ="jdbc:odbc:driver={MicrosoftAccessDriver(*.mdb)};DBQ=dabaseName.mdb"; 

  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 

Connection conn = DriverManager.getConnection(dbURL);


  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 扫一扫,分享海报

©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值