常用數據庫JDBC連接寫法
MySQL()mm
mysql
bin
jar
Class
forName(
org
gjt
mm
mysql
Driver
);
cn = DriverManager
getConnection(
jdbc:mysql://MyDbComputerNameOrIP:
/myDatabaseName
sUsr
sPwd );
PostgreSQL()pgjdbc
jar
Class
forName(
org
postgresql
Driver
);
cn = DriverManager
getConnection(
jdbc:postgresql://MyDbComputerNameOrIP/myDatabaseName
sUsr
sPwd );
Oracle()classes
zip
Class
forName(
oracle
jdbc
driver
OracleDriver
);
cn = DriverManager
getConnection(
jdbcracle:thin:@MyDbComputerNameOrIP:
:ORCL
sUsr
sPwd );
Sybase()jconn
jar
Class
forName(
com
sybase
jdbc
jdbc
SybDriver
);
cn = DriverManager
getConnection(
jdbc:sybase:Tds:MyDbComputerNameOrIP:
sUsr
sPwd );
//(Default
Username/Password:
dba
/
sql
)
Microsoft SQLServer()
Class
forName(
net
sourceforge
jtds
jdbc
Driver
);
cn = DriverManager
getConnection(
jdbc:jtds:sqlserver://MyDbComputerNameOrIP:
/master
sUsr
sPwd );
Microsoft SQLServer()
Class
forName(
com
microsoft
jdbc
sqlserver
SQLServerDriver
);
cn = DriverManager
getConnection(
jdbc:microsoft:sqlserver://MyDbComputerNameOrIP:
;databaseName=master
sUsr
sPwd );
ODBC
Class
forName(
sun
jdbc
odbc
JdbcOdbcDriver
);
Connection cn = DriverManager
getConnection(
jdbcdbc:
+ sDsn
sUsr
sPwd );
DB
Class
forName(
DB
Driver
);
String url=
jdbc:db
://
:
/SAMPLE
cn = DriverManager
getConnection( url
sUsr
sPwd );
From:http://tw.wingwit.com/Article/program/Oracle/201311/17201.html