各種DBMS的JDBC鏈結字串

2021-06-02 23:18:09 字數 1193 閱讀 2840

1.oracle

thin驅動連線字串:jdbc:oracle:thin:使用者名稱/密碼@localhost:1521:cake

驅動類:oracle.jdbc.driver.oracledriver

2.mysql

連線字串:jdbc:mysql://localhost:3306/資料庫名?useunicode=true&characterencoding=utf-8

驅動類:com.mysql.jdbc.driver

3.sql server

連線字串:jdbc:microsoft:sqlserver://localhost:1433;user=sa;password=sa;databasename=資料庫名

驅動類:com.microsoft.jdbc.sqlserver.sqlserverdriver

//microsoft sql server 2005

string classstr="com.microsoft.sqlserver.jdbc.sqlserverdriver";

string constr="jdbc:sqlserver:";//注意埠號

//microsoft sql server 2000

string classstr="com.microsoft.jdbc.sqlserver.sqlserverdriver";

string constr="jdbc:microsoft:sqlserver://localhost:1433;databasename=pubs","sa","password"

//mysql

"com.mysql.jdbc.driver"

"jdbc:mysql://localhost:3306/login?useunicode=true&characterencoding=utf-8","root","7415"

//oracle

"oracle.jdbc.driver.oracledriver"

"jdbc:oracle:thin:@10.0.0.248:1521:ora9","username","password"

//odbc橋連線

class.forname("sun.jdbc.odbc.jdbcodbcdriver"); 

connection con=drivermanager.getconnection("jdbc:odbc:jsp"); 

各種資料庫的JDBC鏈結

jdbc microsoft sqlserver localhost 1433 databasename northwind com.microsoft.jdbc sqlserver sqlserverdriver msbase.jar mssqlserver.jar msutil.jar down...

JDBC連線各種資料庫的字串

oracle driverclass oracle.jdbc.driver.oracledriver url jdbc oracle thin 127.0.0.1 1521 orcl 資料庫的使用者名稱和密碼寫在connection connection drivermanager.getconne...

jdbc鏈結資料庫的方式

1 oracle資料庫 class.forname oracle.jdbc.driver.oracledriver newinstance string url jdbc oracle thin localhost 1521 orcl orcl為資料庫的sid string user test st...