Vista下Java 连接到SQLServer 2005
1.首先安装SQLServer 2005,如果你还不会安装的话请看我的文章《 Vista下安装SQL SERVER 2005 EXPRESS 》 2.安装SQLServer 2005的数据库驱动。在Microsoft的官方网站有得下载。你可以通过以下方法下载: a.在这里自己找一个下载(能找到最新的) b.在这里直
1. 首先安装SQLServer 2005,如果你还不会安装的话请看我的文章《 Vista下安装SQL SERVER 2005 EXPRESS 》
2.安装SQLServer 2005的数据库驱动。在Microsoft的官方网站有得下载。你可以通过以下方法下载:
a.在这里自己找一个下载(能找到最新的)
b.在这里直接下载(我就是下这个,已经不是最新了)
注:有些浏览器可能会下载到htm或html文件,这时你用浏览器打开你下载到的htm或html文件,然后点击页面的“我同意服务条款”,这时就会出现弹出框,允许就可以了。如果你的浏览器也还是没有弹出,那么你在那个“我同意服务条款”的链接上“右键”--“属性”,然后把地址复制下来,直接在浏览器粘贴地址就可以到达下载页面。(我的IE8就是这样的=_=///)
3.将你下载后的文件进行解压,假如路径是:%programe%/Microsoft SQL Server 2005 JDBC Driver
4. 打开环境变量设置classpath。%InstallationDirectory%/Microsoft SQL Server 2005 JDBC Driver/sqljdbc_
5.这样SQLServer 2005 的JDBC驱动大致就安装完了,还比较顺利。
6.这时你可能急着想写个Java来查询数据库了吧。
7.真是不好运,很可能运行出现了错误
8.好吧。开始除错。
9.检查有没有开启SQLExpress(SQLServer)的协议。打开SQLServer Configuration Manager(配置管理器)。
a.依次点击左栏的“SQLServer 2005 网络配置”--“SQLExpress的协议”
b.看右栏的“TCP/IP”协议的“状态”,请右键-“启用”(当状态为“已禁用”时)。然后进行端口的设置。
在"TCP/IP"上右键--“属性”--“IP地址”--将滚动条拉到最下面可以看到“ipall”--将“TCP端口”写入1433
c.重启数据库服务器或计算机,这样就完成SQLServer端的配置了。
10.重新执行刚才那个Java文件, 此时居然提示“com.microsoft.sqlserver.jdbc.SQLServerException: 用户 'IBM' 登录失败。”
不用怕,还是能解决的。
打开SQL Server Management Studio Express
a.在左栏的“对象资源管理器”--安全性上右键--“新建”--“登录”
b.点击左栏的“常规”,在登录名那里输入一个你要用来连接的用户名,输入密码,取消“用户在下次登录时必须更改密码”(如果你觉得没必要的话,反正我是取消了),先别那么快点确定。
c.点击左栏的“用户映射”,在右栏选择你这个用户可以控制的数据库。然后在下面的数据库角色成员身份选择"public"(默认选中)和"db_owner",还差一步,先别确定。
d.点击左栏的“状态”,将右栏的“设置”--“授予”,“登录”--“启用”,一般都是这2个值。不过也要预防特殊的....^_^
e.好吧,你那么想点确定就点吧。
11.终于完成了配置。可以执行刚才那个文件啦~
注:如果还是不能连接到数据库,请查看是否有一些防火墙或安全工具禁用了SQL Server的网络服务或1433端口。同时确保你的java代码:端口号,数据库,服务器,驱动,用户名,密码等都没写错

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Java 8 introduces the Stream API, providing a powerful and expressive way to process data collections. However, a common question when using Stream is: How to break or return from a forEach operation? Traditional loops allow for early interruption or return, but Stream's forEach method does not directly support this method. This article will explain the reasons and explore alternative methods for implementing premature termination in Stream processing systems. Further reading: Java Stream API improvements Understand Stream forEach The forEach method is a terminal operation that performs one operation on each element in the Stream. Its design intention is

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python each have their own advantages and are suitable for different scenarios. 1.PHP is suitable for web development and provides built-in web servers and rich function libraries. 2. Python is suitable for data science and machine learning, with concise syntax and a powerful standard library. When choosing, it should be decided based on project requirements.

Capsules are three-dimensional geometric figures, composed of a cylinder and a hemisphere at both ends. The volume of the capsule can be calculated by adding the volume of the cylinder and the volume of the hemisphere at both ends. This tutorial will discuss how to calculate the volume of a given capsule in Java using different methods. Capsule volume formula The formula for capsule volume is as follows: Capsule volume = Cylindrical volume Volume Two hemisphere volume in, r: The radius of the hemisphere. h: The height of the cylinder (excluding the hemisphere). Example 1 enter Radius = 5 units Height = 10 units Output Volume = 1570.8 cubic units explain Calculate volume using formula: Volume = π × r2 × h (4

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

The reasons why PHP is the preferred technology stack for many websites include its ease of use, strong community support, and widespread use. 1) Easy to learn and use, suitable for beginners. 2) Have a huge developer community and rich resources. 3) Widely used in WordPress, Drupal and other platforms. 4) Integrate tightly with web servers to simplify development deployment.
