数据库连接driverClass和jdbcUrl大全

一、MySQL:

driverClass:com.mysql.jdbc.Driver
                         org.gjt.mm.mysql.Driver

jdbcUrl:jdbc:mysql://192.168.0.1:3306/yourDBName

硬编码(不建议):

        Class.forName("com.mysql.jdbc.Driver", true, Thread.currentThread().getContextClassLoader());
        conn=DriverManager.getConnection("jdbc:mysql://192.168.0.1:3306/yourDBName?user=userName&password=123&useUnicode=true&characterEncoding=gb2312");

 

二、Oracle:

 (thin模式)

driverClass:oracle.jdbc.driver.OracleDriver

jdbcUrl:jdbc:oracle:thin:@192.168.0.1:1521:yourDBName

 

三、SQL Server:

driverClass:com.microsoft.sqlserver.jdbc.SQLServerDriver(2005版本及以后)

                    com.microsoft.jdbc.sqlserver.SQLServerDriver(2000版本)

jdbcUrl:jdbc:sqlserver://192.168.0.1:1433;databasename=yourDBName

 

四、Sybase:

driverClass:com.sybase.jdbc3.jdbc.SybDriver
                         com.sysbase.jdbc.SybDriver

jdbcUrl:jdbc:sybase:Tds:127.0.0.1:5007/myDB

 

五、DB2:

1、db2java.zip

driverClass:COM.ibm.db2.jdbc.net.DB2Driver

jdbcUrl:jdbc:db2://127.0.0.1:5000/DBNAME

2、db2jcc.jar

driverClass:com.ibm.db2.jcc.DB2Driver

jdbcUrl:jdbc:db2://127.0.0.1:5000/DBNAME
3、
driverClass:com.ibm.db2.jdbc.app.DB2DriverjdbcUrl:jdbc:db2://127.0.0.1:5000/yourDBName

 

 六、Informix:

driverClass:com.informix.jdbc.IfxDriver

jdbcUrl:jdbc:informix-sqli://127.0.0.1:1533/yourDBName:informixserver=myserver;user=test;password=test123

 

七、PostgreSQL:

driverClass:org.postgresql.Driver

jdbcUrl:jdbc:postgresql://127.0.0.1:5432/yourDBName

 
八、Access:

driverClass:sun.jdbc.odbc.JdbcOdbcDriver

jdbcUrl:jdbc:odbc:dataSourceName

你可能感兴趣的:(数据库连接driverClass和jdbcUrl大全)