数据库连接? [英] database connectivity?

查看:84
本文介绍了数据库连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何建立与Java应用程序的SQL 2005数据库连接.实际上,我不知道如何为JDBC设置路径.任何帮助都会很棒.

How to establish SQL 2005 database connectivity with Java application. Actually I don't know how to set path for JDBC. Any help would be great.

推荐答案

  1. http://下载jdbc驱动程序www.microsoft.com/sqlserver/2005/en/us/java-database-connectivity.aspx .
  2. 您可以下载Windows或Unix版本.使用哪一个都没关系.
  3. 如果选择Windows版本,请运行下载的exe文件;否则,请执行以下操作.这将在您将文件下载到的目录中创建一个名为Microsoft SQL Server 2005 JDBC驱动程序的目录.
  4. 将文件Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.2\enu\sqljdbc.jar添加到类路径中(使用java-cp选项,或者,如果使用的是应用服务器,则将其放置在适当的目录中).
  5. 设置您的连接.基本上,所需的信息是:
    • 驱动程序类名称:com.microsoft.sqlserver.jdbc.SQLServerDriver
    • 连接网址:jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]
  1. Download the jdbc driver from http://www.microsoft.com/sqlserver/2005/en/us/java-database-connectivity.aspx.
  2. You can either download the Windows or Unix version. It does not really matter which one you use.
  3. If you chosed the Windows version, run the downloaded exe file; this will create a directory called Microsoft SQL Server 2005 JDBC Driver in the directory you downloaded the file to.
  4. Add the file Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.2\enu\sqljdbc.jar to your classpath (either using the -cp option of java or, if you are using an application server, by putting it in the appropriate directory).
  5. Set your connection. Basically, the information required for this are:
    • the driver class name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    • the connection url: jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]

检查使用JDBC驱动程序连接到SQL Server 获取更多详细信息和/或help目录中可用的资源(示例代码在help/samples/connections/ConnectURL.java中提供).

Check Connecting to SQL Server with the JDBC Driver for more details and/or the resources available in the help directory (sample code available in help/samples/connections/ConnectURL.java).

这篇关于数据库连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆