- 各种数据库对应的jar包
数据库类型 |
对应的Jar文件 |
Oracle 8i |
classes12.zip 或 ojdbc14.jar |
Sybase |
jconn2.jar 或 jconn3.jar |
Mysql |
mysql-connector-java-3.1.1-alpha-bin.jar 或 mysql-connector-java-5.0.2-beta-bin.jar |
SQLServer 2000 |
msbase.jar、msutil.jar、mssqlserver.jar |
SQLServer 2005 |
sqljdbc.jar |
SQLServer 7.0 |
jtds-1.2.2.jar |
Informix |
ifxjdbc.jar |
DB2 |
db2jcc.jar、db2jcc_license_cu.jar |
- 各种数据库对应的驱动类名和URL格式
下面是对各种数据库的驱动类名和URL格式。其中hostip代表ip地址,dbname代表数据库名。
数据库 |
驱动类名 |
URL格式 |
Oracle |
oracle.jdbc.driver.OracleDriver |
jdbc:oracle:thin:@hostip:1521:dbname |
Sybase |
com.sybase.jdbc2.jdbc.SybDriver |
jdbc:sybase:Tds:hostip:4100/dbname |
Mysql |
com.mysql.jdbc.Driver |
jdbc:mysql://hostip:3306/dbname?useUnicode=true&characterEncoding=GBK |
SQLServer 2000 |
com.microsoft.jdbc.sqlserver.SQLServerDriver |
jdbc:microsoft:sqlserver://hostip:1433;DatabaseName=dbname |
SQLServer 2005 |
com.microsoft.sqlserver.jdbc.SQLServerDriver |
jdbc:sqlserver://hostip:1433;DatabaseName=dbname |
SQLServer 7.0 |
net.sourceforge.jtds.jdbc.Driver |
jdbc:jtds:sqlserver://hostip:1433/dbname |
DB2 |
com.ibm.db2.jcc.DB2Driver |
jdbc:db2://hostip:50000/dbname |
Informix |
com.informix.jdbc.IfxDriver |
jdbc:informix-sqli://hostip:port/dbname:informixserver=<dbservername> |
- 数据库连接池
如果使用 alibaba的 druid 数据库连接池,则连接池会根据jdbc的url前缀自动识别driverclass
前缀 | DriverCLass |
jdbc:odps | com.aliyun.odps.jdbc.OdpsDriver |
jdbc:derby | org.apache.derby.jdbc.EmbeddedDriver |
jdbc:mysql | com.mysql.jdbc.Driver |
jdbc:oracle | oracle.jdbc.driver.OracleDriver |
jdbc:microsoft | com.microsoft.jdbc.sqlserver.SQLServerDriver |
jdbc:sybase:Tds | com.sybase.jdbc2.jdbc.SybDriver |
jdbc:jtds | net.sourceforge.jtds.jdbc.Driver |
jdbc:postgresql | org.postgresql.Driver |
jdbc:fake | com.alibaba.druid.mock.MockDriver |
jdbc:mock | com.alibaba.druid.mock.MockDriver |
jdbc:hsqldb | org.hsqldb.jdbcDriver |
jdbc:db2 | COM.ibm.db2.jdbc.app.DB2Driver |
jdbc:sqlite | org.sqlite.JDBC |
jdbc:ingres | com.ingres.jdbc.IngresDriver |
jdbc:h2 | org.h2.Driver |
jdbc:mckoi | com.mckoi.JDBCDriver |
jdbc:cloudscape | COM.cloudscape.core.JDBCDriver |
jdbc:informix-sqli | com.informix.jdbc.IfxDriver |
jdbc:timesten | com.timesten.jdbc.TimesTenDriver |
jdbc:as400 | com.ibm.as400.access.AS400JDBCDriver |
jdbc:sapdb | com.sap.dbtech.jdbc.DriverSapDB |
jdbc:JSQLConnect | com.jnetdirect.jsql.JSQLDriver |
jdbc:JTurbo | com.newatlanta.jturbo.driver.Driver |
jdbc:firebirdsql | org.firebirdsql.jdbc.FBDriver |
jdbc:interbase | interbase.interclient.Driver |
jdbc:pointbase | com.pointbase.jdbc.jdbcUniversalDriver |
jdbc:edbc | ca.edbc.jdbc.EdbcDriver |
jdbc:mimer:multi1 | com.mimer.jdbc.Driver |