JDBC 常用连接字符串

       Db Name: Microsoft SQL Server (6.5, 7, 2000 and 2005) and Sybase (10, 11, 12).

JDBC Name: jTDS    ----- jtds-1.2.1.jar
Home Page: http://jtds.sourceforge.net/
JDBC Ver: 1.2.1

Conn Code:
   Class.forName("net.sourceforge.jtds.jdbc.Driver");
   Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://host:port/database", "user", "password");
or
   Connection con = DriverManager.getConnection("jdbc:jtds:sybase://host:port/database", "user", "password");

--------------------------------------------------------------------------------------------------------------------


       Db Name: MySQL

JDBC Name: Connector/J    -----  mysql-connector-java-5.0.7-bin.jar
Home Page: http://dev.mysql.com/
JDBC Ver: 3.1
Download: http://dev.mysql.com/downloads/

Conn Code:
   Class.forName("com.mysql.jdbc.Driver");
   Connection con = DriverManager.getConnection("jdbc:mysql://host:port/database", "user","password");
-------------------------------------------------------------------------------------------------------------------


       Db Name: Microsoft SQL Server 2000

JDBC Name: SQL Server 2000 Driver for JDBC    -----  msbase.jar | mssqlserver.jar | msutil.jar
Home Page: http://www.microsoft.com/china/sql/
JDBC Ver: (SQL Server 2000 Driver for JDBC)

Conn Code:
   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
   Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://host:1433; DatabaseName=DBName", "user", "password");
-------------------------------------------------------------------------------------------------------------------

       Db Name: MS Access or Ms Foxpro

Conn Code:
   step 1: 配置 odbc 数据源(例如:myDSN)
   step 2:
     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       Connection con = DriverManager.getConnection("jdbc:odbc:myDSN");

   or *******************************************************************************
     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       Connection con = DriverManager.getConnection("jdbc:odbc:driver=
                                                                  {Microsoft Access Driver (*.mdb)};DBQ=database.mdb","","");

你可能感兴趣的:(JDBC 常用连接字符串)