数据库连接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

 

JDBC mysql下载地址:https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.13.zip

JDBC oracal下载地址:https://www.oracle.com/technetwork/database/application-development/jdbc/downloads/index.html

posted @ 2018-11-22 08:48  点点花飞谢  阅读(1027)  评论(0编辑  收藏  举报