`

常用数据库的驱动程序及JDBC URL

阅读更多

<!----><!----><!----><!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:Verdana; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:536871559 0 0 0 415 0;} @font-face {font-family:楷体_GB2312; panose-1:2 1 6 9 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:1 135135232 16 0 262144 0;} @font-face {font-family:"\@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"\@楷体_GB2312"; panose-1:2 1 6 9 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:1 135135232 16 0 262144 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; mso-hyphenate:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:.5pt; mso-fareast-language:AR-SA;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> <!---->

常用数据库的驱动程序及 JDBC URL:

Oracle 数据库 :

驱动程序包名: ojdbc14.jar

  驱动类的名字: oracle.jdbc.driver.OracleDriver

  JDBC URL jdbc:oracle:thin:@ dbip:port:databasename

  说明:驱动程序包名有可能会变

       JDBC URL 中黑色字体部分必须原封不动的保留,为该驱动识别的 URL 格式。红色字体部分需要根据数据库的安装情况填写。其中各个部分含义如下:

        dbip 为数据库服务器的 IP 地址,如果是本地可写: localhost 127.0.0.1

        port 为数据库的监听端口,需要看安装时的配置,缺省为 1521

        databasename 为数据库的 SID ,通常为全局数据库的名字。

        举例如果要访问本地的数据库 allandb ,端口 1521 ,那么 URL 写法如下:

       jdbc:oracle:thin:@localhost:1521:allandb 下载地址如下 :

http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html

 

SQL Server 数据库

   驱动程序包名: msbase.jar mssqlserver.jar msutil.jar

   驱动类的名字: com.microsoft.jdbc.sqlserver.SQLServerDriver

   JDBC URL jdbc:microsoft:sqlserver:// dbip:port;DatabaseName=databasename

   说明:驱动程序包名有可能会变

        JDBC URL 中黑色字体部分必须原封不动的保留,为该驱动识别的 URL 格式。红色字体部需要根据数据库的安装情况填写。其中各个部分含义如下:

       dbip 为数据库服务器的 IP 地址,如果是本地可写: localhost 127.0.0.1

        port 为数据库的监听端口,需要看安装时的配置,缺省为 1433

       databasename 数据库的名字

       举例如果要访问本地的数据库 allandb ,端口 1433 ,那么 URL 写法如下:

       jdbc: microsoft: sqlserver:@localhost:1433; DatabaseName =allandb

       下载地址: http://www.microsoft.com/downloads/details.aspx

 

  MySQL 数据库

   驱动程序包名: mysql-connector-java-3.1.11-bin.jar

   驱动类的名字: com.mysql.jdbc.Driver

   JDBC URL jdbc:mysql:// dbip:port/databasename

   说明:驱动程序包名有可能会变

        JDBC URL 中黑色字体部分必须原封不动的保留,为该驱动识别的 URL 格式。红色字体部需要根据数据库的安装情况填写。其中各个部分含义如下:

        dbip 为数据库服务器的 IP 地址,如果是本地可写: localhost 127.0.0.1

        port 为数据库的监听端口,需要看安装时的配置,缺省为 3306

        databasename 数据库的名字

        举例如果要访问本地的数据库 allandb ,端口 1433 ,那么 URL 写法如下:

       jdbc:mysql://localhost:3306/allandb

   下载地址: http://dev.mysql.com/downloads/connector/j/

 

Access 数据库

   驱动程序包名:该驱动程序包含在 JavaSE 中,不需要额外安装。

   驱动类的名字: sun.jdbc.odbc.JdbcOdbcDriver

   JDBC URL jdbc:odbc: datasourcename

   说明:该驱动只能工作在 Windows 系统中,首先需要在操作系统中建立一个可以访问 Access 数据库的本地数据源 (ODBC) ,如果名字为 allandb ,那么 URL 写法如下:

        jdbc:odbc:allandb

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics