2024年5月20日发(作者:泰天罡)
各种数据库驱动
数据库名称
Mysql
下载地址
/prod
ucts/connector/j/
说明
Shipped. But need to
download the latest for
MySQL 4.1 or higher.
/projec
t/?group_id=33
Oracle
291
software/tech/java/sqlj_jdbc/
Included.
/pro
Included. Support
SQL Server by jTDS ject/?group_i
Microsoft SQL Server
d=33291
(6.5, 7, 2000 and 2005)
Postgres
SAP DB
SyBase by jTDS
/
Included 7.3 JDBC 3
/sap
Included.
_db_
Included. Support Sybase
(10, 11, 12)
t/
各种驱动的连接方法
1. MySQL() ;
e( "" );
cn=nection( "jdbc:mysql:
//MyDbComputerNameOr IP:3306/myDatabaseName", sUsr, sPwd );
2. PostgreSQL() ;
e( "" );
cn=nection( "jdbc:postgresql:
//MyDbComputerNameOrIP/myDatabaseName", sUsr, sPwd );
(/ip/deploy/database/oracle9i/)
;
e("Driver");
cn=nection("jdbc:oracle:
thin:MyDbComputerNameOrIP:1521:ORCL", sUsr, sPwd );
4. Sybase() ;
e( "ver" );
cn =
nection( "jdbc:sybase:Tds:MyDbComputerNameOrIP
:2638", sUsr, sPwd );
//(Default-Username/Password: "dba"/"sql")
5. Microsoft SQLServer() ;
e( "" );
cn =
nection( "jdbc:jtds:sqlserver://MyDbComputerName
OrIP:1433/master", sUsr, sPwd );
6. Microsoft SQLServer() ;
e( "verDriver" );
cn =
nection( "jdbc:microsoft:sqlserver://MyDbComputer
NameOrIP:1433;databaseName=master", sUsr, sPwd );
7. ODBC
e( "bcDriver" );
Connection cn = nection( "jdbc:dbc:" + sDsn, sUsr,
sPwd );
2 e("2Driver");
String url="jdbc:db2://192.9.200.108:6789/SAMPLE"
cn = nection( url, sUsr, sPwd );
由于access并不是作为一项服务运行,所以url的方法对他不适用。access
可以通过odbc,也可以通过服务器映射路径的形式 找到.mdb文件,参
见
/Access/
一、连接各种数据库方式速查表
下面罗列了各种数据库使用JDBC连接的方式,可以作为一个手册使用。
1、Oracle8/8i/9i数据库(thin模式)
e("Driver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl"; //orcl为数据库
的SID
String user="test";
String password="test";
Connection conn=
nection(url,user,password);
2、DB2数据库
e("2Driver
").newInstance();
String url="jdbc:db2://localhost:5000/sample"; //sample为你的数
据库名
String user="admin";
String password="";
Connection conn=
nection(url,user,password);
2024年5月20日发(作者:泰天罡)
各种数据库驱动
数据库名称
Mysql
下载地址
/prod
ucts/connector/j/
说明
Shipped. But need to
download the latest for
MySQL 4.1 or higher.
/projec
t/?group_id=33
Oracle
291
software/tech/java/sqlj_jdbc/
Included.
/pro
Included. Support
SQL Server by jTDS ject/?group_i
Microsoft SQL Server
d=33291
(6.5, 7, 2000 and 2005)
Postgres
SAP DB
SyBase by jTDS
/
Included 7.3 JDBC 3
/sap
Included.
_db_
Included. Support Sybase
(10, 11, 12)
t/
各种驱动的连接方法
1. MySQL() ;
e( "" );
cn=nection( "jdbc:mysql:
//MyDbComputerNameOr IP:3306/myDatabaseName", sUsr, sPwd );
2. PostgreSQL() ;
e( "" );
cn=nection( "jdbc:postgresql:
//MyDbComputerNameOrIP/myDatabaseName", sUsr, sPwd );
(/ip/deploy/database/oracle9i/)
;
e("Driver");
cn=nection("jdbc:oracle:
thin:MyDbComputerNameOrIP:1521:ORCL", sUsr, sPwd );
4. Sybase() ;
e( "ver" );
cn =
nection( "jdbc:sybase:Tds:MyDbComputerNameOrIP
:2638", sUsr, sPwd );
//(Default-Username/Password: "dba"/"sql")
5. Microsoft SQLServer() ;
e( "" );
cn =
nection( "jdbc:jtds:sqlserver://MyDbComputerName
OrIP:1433/master", sUsr, sPwd );
6. Microsoft SQLServer() ;
e( "verDriver" );
cn =
nection( "jdbc:microsoft:sqlserver://MyDbComputer
NameOrIP:1433;databaseName=master", sUsr, sPwd );
7. ODBC
e( "bcDriver" );
Connection cn = nection( "jdbc:dbc:" + sDsn, sUsr,
sPwd );
2 e("2Driver");
String url="jdbc:db2://192.9.200.108:6789/SAMPLE"
cn = nection( url, sUsr, sPwd );
由于access并不是作为一项服务运行,所以url的方法对他不适用。access
可以通过odbc,也可以通过服务器映射路径的形式 找到.mdb文件,参
见
/Access/
一、连接各种数据库方式速查表
下面罗列了各种数据库使用JDBC连接的方式,可以作为一个手册使用。
1、Oracle8/8i/9i数据库(thin模式)
e("Driver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl"; //orcl为数据库
的SID
String user="test";
String password="test";
Connection conn=
nection(url,user,password);
2、DB2数据库
e("2Driver
").newInstance();
String url="jdbc:db2://localhost:5000/sample"; //sample为你的数
据库名
String user="admin";
String password="";
Connection conn=
nection(url,user,password);