sqL2008连接失败解决办法
- 格式:docx
- 大小:15.22 KB
- 文档页数:2
安装的SQL Server2008 R2版的连接不到本地数据可,提示未找到或无法访问服务器的解决方法。
如果安装使用“SQL Server 身份验证”的话请在安装完成后按以下步骤设置一下:
一、Microsoft SQL Server 2008—>配置工具—>SQL Server 配
置管理器—>SQL Server 服务,启动SQL Server
(MSSQLSERVER)服务和SQL Server 代理(MSSQLSERVER)服务。
放大图:
右键SQL Server (MSSQLSERVER)服务—> 启动
等待ing
右键SQL Server 代理(MSSQLSERVER)服务—> 启动
等待ing
OK以后出现:
二、SQL Server 网络配置—>MSSQLSERVER的协议,启动
TCP/IP即可。
双击MSSQLSERVER的协议出现以下界面:
右键TCP/IP(界面如下)—> 启动:
点击确定
到达这里就大功告成了!!!重现打开SQL Server Management Studio
连接成功的说o(∩_∩)o。
64bit环境下解决PowerBuilder9连不上sql server 2008的问题最近把电脑的内存升级到4G,为了更好的利用内存,决定安装WIN 7 64 bit的操作系统,同时安装了64 bit的Microsoft SQL Server 2008 R2。
安装PowerBuilder 9.0后在自带的Database中配置MSS Microsoft SQL Server,总连接不上本机的SQL Server 2008,换个服务器上也是安装的64 bit的SQL Server 2008,测试连接时,弹出的是如下提示。
但是连接32 bit 的SQL Server 2005,可以连接成功。
怎么解决该问题?第一步,需要把PB的一个公共文件ntwdblib.dll放在系统盘中。
经测试放在system32下,连接不上。
第二步,需要放置在正确的目录中。
这个文件在32位和64位下放置的目录是不一样的,32位系统为:C:\WINNT\System32 而64位系统为C:\Windows\SysWOW64。
第三步,需要放置与连接的服务器版本一致的文件版本。
把文件放在SysWOW64下,发现目录中已有该文件,查看对应的文件版本是1998.11.13.0。
根据网上查询的资料了解,ntwdblib.dll有几个不同版本,只有版本正确才能连上对应的sql server。
下面是对应关系:ntwdblib.dll版本为2000.2.8.0是对应SqlServer2000ntwdblib.dll版本为2000.80.194.0是对应SqlServer2005ntwdblib.dll版本为2000.80.2039是对应SqlServer2008因此本机自带的这个文件的版本太老了。
下载对应Sql Server 2008的版本,重新在Database中连接SQL Server 2008的数据库,测试通过。
一.启动和登录SQL Server Management Studio1.单击Windows开始菜单。
2.选择“程序”或者“所有程序”命令。
3.选择Microsoft SQLServer2008目录。
4.选择SQL Server Management。
图-1 登录SQL Server Management Studio图-2 登录时发生“无法连接”的错误发生上面这样的错误(图-2),一般来说只有两种情况:第一种情况是你的"服务器名称"项填写错误了,第二种情况就是检查你的服务器是否启动了,检查的方法如下:1.单击Windows开始菜单2.选择“程序”或者“所有程序”命令。
3.选择Microsoft SQLServer2008命令。
4.选择配置工具命令。
5.选择SQL Server配置管理器,打开后窗口如下图(图-3)注意看你的服务器是否如下图(图-3)所示,要连接的服务器是否处于"正在运行"状态。
启动模式就好解释了,自动就是随系统启动,手动就是啥时候需要了自己来启动。
图-3 服务器状态二.修改登录验证模式图-4 登录错误如果遇到用SQL Server身份验证模式登录出现上面(图-4)的错误的话,多是因为SQL Server服务器没有启用TCP/IP协议,按照下面的步骤检查一下设置:1.单击Windows开始菜单。
2.选择"程序"或者"所有程序"命令。
3.选择Microsoft SQLServer 2008命令。
4.选择配置工具命令。
5.单击SQL Server配置管理器。
6.展开配置管理器左边的"SQL Server网络配置"节点。
7.单击"MS SQL SERVER的协议"选项。
8.得到下图(图-5),设置启用它的Named Pipes(命名管道)和TCP/IP协议。
双击TCP/IP选项,弹出如下图(图-6)所示的对话框。
SQL数据库连接失败的解决办法In the process of using SQL Server, the most problem that users encounter is that the connection fails. Generally speaking, there are two ways to connect to the SQL Server, one is to use SQL built-in Server client tools, such as enterprise manager, query analyzer, profiler; two is the use of users to develop their own client programs, such as ASP, VB script program, the client program and the use of ODBC or OLE DB connection SQL Server. Next, we will talk about these two ways of connection, specifically how to solve the problem of connection failure.First, the client tool connection failedWhen using SQL Server's own client tool (for example, enterprise manager) to connect to SQL Server, the most common errors are as follows:1, SQL Server does not exist or access is deniedConnectionOpen (Connect ())2, user'sa'logon failed. Reason: not associated with trusted SQL Server connection.3, the timeout has expired.Here we are in turn explaining how to solve the three most common connection errors.The first error, "SQL Server does not exist or is denied access", is usually the most complex, the reason for the error isrelatively large, and there are more aspects to be examined. Generally speaking, there are several possibilities:1, the SQL Server name or IP address spelled incorrectly;2, server-side network configuration is wrong;3, the client network configuration is wrong.To solve this problem, we usually follow the following steps to find out the cause of the error step by step.First, check the network physical connection:Ping < server IP address >perhapsPing < server name >If Ping < server IP address > fail to indicate physical connection problem, check hardware equipment such as network card, HUB, router and so on. Another possibility is that firewall software is installed between the client and the server, such as ISA Server. Firewall software may mask the response to Ping, Telnet, and so on, when checking connection problems, we have to temporarily shut down firewall software, or open all closed ports.If Ping < server IP address > successful and Ping < server name > failed, then the name resolve problem, at this time to checkthe DNS service is normal. Sometimes the client and the server is not in the same LAN, this is probably not directly use the server name to identify the server, we can use the HOSTS file to name resolution, the specific method:1, use Notepad to open the HOSTS file (usually inC:\WINNT\system32\drivers\etc)2, add a IP address and server name corresponding records, such as:172.168.10.24 MyserverYou can also configure it in the SQL Server client network utility, which will be described in detail later.Next, check the SQL Server server working state using the telnet command:Telnet < server IP address > 1433If the command is executed successfully, can see the cursor in the upper left corner of the screen flash flashing, indicating that the SQL Server server is working, and is listening on port 1433 TCP/IP connection; if a command returns "cannot open connection" error message, the server does not start the SQL Server service, the server may not enable the TCP/IP protocol server, or not in the SQL Server default port 1433 monitor.Next, we'll check the server's network configuration on the server, check whether the named pipe is enabled, whether theTCP/IP protocol is enabled, and so on. We can use SQL Server own server network to use tools to check.Click: program > Microsoft SQL Server > server network using tools, after opening the tool to see the picture as shown in the following picture:From here, we can see what protocols have been enabled by the server. In general, we enable named pipes as well as TCP/IP protocols.Click on the TCP/IP protocol and select properties, so we can check the settings for the default port of the SQL Server service, as shown in the following figure:In general, we use the default port 1433 of SQL Server. If the hidden server is selected, it means that the client cannot see the server through the enumeration server, and it has a protective effect, but it doesn't affect the connection.Check out the server side network configuration, and then we'll go to the client to check the client's network configuration. We can also use SQL Server own client network using tools to check, the difference is that this is the client to run this tool.Click: program > Microsoft SQL Server > client network using tools, after opening the tool to see the picture as shown in the following picture:From here, we can see which protocols are enabled by the client.In general, we also need to enable named pipes as well as TCP/IP protocols.Click the TCP/IP protocol and select properties to check the settings for the client's default connection port, as shown in the following figure.The port must be consistent with the server.Click the alias tab, and you can also configure aliases for the server. The alias of the server is the name used to connect, and the server in the connection parameter is the real server name, both of which can be the same or different. As shown in the following figure, we can use Myserver instead of the real server name sql2kcn-02, and use the network library Named Pipes. The alias setting is similar to using the HOSTS file.Through the above examination, the cause of error 1 can be eliminated basically. Here's a more detailed description of how to solve the bug 2.When the user attempts to use SA in the query analyzer to connect to the SQL Server,Or use the SA in the enterprise manager to create a new SQL Server. When you register, you'll often encounter error information as shown in figure 2. The reason for this error is that the SQL Server uses a "Windows only" authentication method, so the user cannot connect with the login account of the SQL Server (such as SA). The solution is as follows:1, use the enterprise manager on the server side and choose to use Windows authentication to connect to SQL Server;2. Expand the SQL Server group, right-click the name of the SQL Server server, select properties, and then select the security tab;3, under authentication, select SQL, Server, and Windows".4. Restart the SQL Server service.In the above solution, if use Windows authentication in the first step SQL Server connection fails, then we will encounter a dilemma: first, the server allows only the authentication of Windows; secondly, even though the use of Windows authentication is still not connected to the server. This situation is visually called "locking yourself out of the door" because no user can use the connection in any way. In fact, we can change authentication to SQL, Server, and Windows hybrid validation by modifying a registry key, as shown below:1, click start, run, enter regedit, enter, and enter the registry editor;2, in turn expand the registry key, browse to the following registry key:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLSer ver]3, find the name "LoginMode" on the right of the screen anddouble-click edit double byte values;4, the value will be changed from 1 to 2, click "ok";5, close the registry editor;6. Restart the SQL Server service.At this point, the user can successfully use SA to create a new SQL Server registry in the enterprise manager, but still cannot use the Windows authentication mode to connect to SQL Server. This is because there are two default login accounts in SQL Server: BUILTIN\Administrators and machine name\Administrator are deleted. To restore these two accounts, you can use the following methods:1, open the enterprise manager, expand the server group, and then expand the server;2, expand security, right click login, and then click New login";3, in the name box, enter BUILTIN\Administrators;4, on the server roles tab, select System Administrators";5, click OK to exit;6, use the same method to add machine name \Administrator login.Following registry keyHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServ er\LoginModeThe value determines what authentication mode the SQL Server will take.This value is 1, indicating the use of the Windows authentication mode; the value is 2, indicating the use of mixed mode (Windows authentication and SQL Server authentication).After looking at how to solve the first two errors, let's look at the third errors shown in figure 3.If you encounter third errors, generally speaking, the client has found the server and can connect, but the connection time is greater than the allowable time to cause an error. This usually occurs when a user runs an enterprise manager on Internet to register another server on the same Internet, and a slow connection may cause the timeout error above. In some cases, such problems can also result from local network problems.To resolve such errors, you can modify the connection timeout settings for the client. By default, registered another SQL Server through the enterprise manager timeout is 4 seconds, while the query analyzer is 15 seconds (which is why the enterprise manager error occurs the possibility of more reasons). Specific steps for:1, in the enterprise manager, select the "tools" on the menu,and then select "options"";2, in the pop-up SQL Server enterprise manager properties window, click the advanced tab;3, in the connection settings under the "login timeout (seconds)" to the right of the box, enter a larger number, such as 20.The query analyzer can also be set in the same location.Two, the application connection failedThe above three error messages occur in the client tool that comes with SQL Server, and we will encounter similar error information in the application, for example:Microsoft, OLE, DB, Provider, for, SQL, Server (0x80004005)[DBNETLIB][ConnectionOpen (Connect ()).]Specified, SQL, server, not, found.Microsoft, OLE, DB, Provider, for, SQL, Server (0x80004005)User'sa'logon failed. Reason: not associated with trusted SQL Server connection.Microsoft, OLE, DB, Provider, for, ODBC, Drivers,error,'80004005'.[Microsoft][ODBC SQL Server Driver] timeout has expiredFirst, let's take a detailed look at the following diagram to see what makes the difference between using ODBC and using OLE DB to connect to SQL Server.From the figure above, we can see that in actual use, the application creates and uses various ADO objects, and the ADO object framework calls for the enjoyment of the OLE DB provider. In order to access the SQL Server database, OLE DB provides two different approaches: the OLE DB provider for SQL Server and the OLE DB provider for ODBC. These two different methods correspond to two different connection strings, and the standard connection string is written as follows:1, use the OLE DB provider for SQL Server:Using SQL Server authentication:oconn。
SQLServer2008R2登录失败的解决⽅法为⼤家分享SQL Server 2008 R2登录失败的解决⽅法1、启动SQL Server 2008 Management Studio,会看到2、⾥⾯有⼀个⾝份验证。
这个⾝份验证的下拉列表⾥⾯有两个选项:Windows ⾝份验证和 SQL Server ⾝份验证。
它们有什么区别:Windows ⾝份验证是指:你可以使⽤你电脑Windows系统的⽤户名和密码进⾏登⼊。
如果你的电脑没有设置密码,那么就不需要输⼊⽤户名和密码,直接点击连接就可以登⼊。
我们⼀般使⽤第⼆种⾝份验证:SQL Server ⾝份验证。
因为,如果我们⽇后在其他的电脑上使⽤数据库的话,我们也可以使⽤。
(如何我们使⽤Windows ⾝份验证,它的缺点是:可移植性不强。
)使⽤SQL Server创建的⽤户名和密码登⼊是最合理的。
3、先将⾝份验证选择:Windows ⾝份验证。
然后点击连接。
接着选择:安全性->登录名。
⿏标右键登录名,选择⾥⾯的新建登录名选择新建SQL Server ⾝份验证,并输⼊登录名和密码我们⼀定要将强制密码过期(X)的选框⾥⾯的勾选去掉4、对着服务器,点击⿏标右键,选择⾥⾯的属性5、进⼊安全性。
你可以看到现在服务器⾝份验证⾥⾯默认的是:Windows ⾝份验证模式,改成SQL Server和Windows⾝份验证模式。
关闭软件重启才会⽣效6、控制⾯板->管理⼯具->服务->找到SQL Server Browser服务,将启动类型改为⾃动,并启动以上就是本⽂的全部内容,希望对⼤家的学习有所帮助,也希望⼤家多多⽀持。
Java连接Sql Server2008数据库连接不上原因及解决办法可能原因一:SqlServer实例的没有启动。
解决办法:进入服务管理器,启动实例的SqlServer。
步骤1:我的电脑-右键—》管理步骤2:双击“服务和应用程序”,在右边找到实例的Sql Server,启动它。
如下图可能原因2:TCP/IP 端口没有配置。
该端口要分2个部分配置:服务器端和客户端解决办法:配置1433端口步骤1:打开sql Server 配置管理器,如下图步骤2:服务器端配置,展开Sql Server服务,如上图。
选择实例的协议,例如我的即选择CYQ 的协议。
步骤3:双击右边TCP/IP选项,选择其中的IP选项,将TCP动态端口修改为1433.(因为SQL Server 2008是动态分配的)如下图,本机使用的时候IP2中“已启用”项要改为是,网络使用时IP1的“已启用”项要改为是步骤4:选“协议选项”,将已启用项及全部监听项选为是步骤5:客户端配置。
选择配置管理器重sql native Client 10.0配置,双击TCP/IP项,将默认端口改为1433步骤6:上面几步完成以后,可以用telnet 127.0.0.0 1433测试本机1433端口是否启用。
进入命令行窗口,输入该指令。
如果已启用,则不会提示连接失败;如果没启用,则提示连接失败,此时就要重新分配端口。
可能原因3:SQL Server安装默认选Wind ow验证模式,没有选混合模式解决办法:改为混合模式,内嵌登录账户为sa,修改其密码。
步骤1:用window验证模式,连接服务器实例,右键选择实例的属性步骤2:选择安全性,修改为混合模式,确定步骤3:选择安全性—》登录名—》sa.,双击sa,修改密码和默认数据库步骤4:进入计算机管理器或者SQL Server配置管理器,重启SQL Server服务。
即可使用sa 账户登录。
可能原因4:java驱动不正确。
为 SQL Server 2005/2008启用远程连接1. 单击"开始",依次选择"程序"、"Microsoft SQL Server 2005/2008"、"配置工具",然后单击"SQL Server 外围应用配置器"。
2. 在"SQL Server 外围应用配置器"页上,单击"服务和连接的外围应用配置器"。
3. 在"服务和连接的外围应用配置器"页上,展开"Database Engine"(数据库引擎),单击"远程连接,选择"本地连接和远程连接"复选框,选择适用于您的环境的相应协议(TCP/IP和Named Pipes),然后单击"应用"和“确定”。
注意:直到重新启动数据库引擎服务后,所做的更改才会生效。
启用 SQL Server Browser 服务1. 单击"开始",依次选择"程序"、"Microsoft SQL Server 2005/2008"、"配置工具",然后单击"SQL Server 外围应用配置器"。
2. 在"SQL Server 外围应用配置器"页上,单击“服务和连接的外围应用配置器”。
3. 在"服务和连接的外围应用配置器"页上,单击"SQL Server Browser",在"启动类型"中单击"自动"选项,然后单击"应用"。
4. 单击"启动",然后单击"确定"。
启用TCP/IP和Named Pipes协议1. SQL Server 2005/2008安装好以后,TCP/IP和Named Pipes默认是禁用的,需要手动的启用。
搞了半天,有点郁闷,google了一大堆,说啥的都有,但都不好使,有的直接宣称该express版本不支持远程连接。
网上主要的说法是以下两步:
1、配置防火墙允许1433端口;
2、打开配置工具里的SQL Server配置管理器,打开“SQL Server网络配置”里的“sqlexpress的协议”,启用右边的“TCP/IP”和“Named Pipes”,并对“TCP/IP”如下配置:
会提示重启Sql Server服务,重启,然后发现还是无法远程连接。
其实还有第三步:
3、更改数据库连接字符串,把端口号加上:
"Server=192.168.1.100\sqlexpress,1433; Database=DbName; User Id=sa; Password=pass"
做完这一步,的确好使了。
但是我还是不明白:为什么明明1433是默认端口,还要显式的写出来呢?。
Java连接sql server2008遇到的问题及解决方法在使用java连接sql server2008时,总会出现很多错误。
java连接sql server2008遇到的问题及解决方法很多。
single在这里分享下自己的经验,供大家参考。
java连接sql server2008遇到的问题之一:使用sql server2008时,无法使用SA用户登陆(应该是所有sql server版本都会出现这样的问题)解决方法:1、打Microsoft Sql Server Management Studio Express,以windows验证方式登陆,打开服务器属性窗口(在数据库服务器图标上点右键选"属性"),选择"安全性"选项,2、服务器验证方式选择SQL SERVERTT和windows验证方式,确认3、然后再到"安全性-登陆名"处设置SA用户属性,4、设置密码(此密码和Java连接代码中的密码一直)5、状态-启用SA用户做完这五个操作后,重新启动数据库,java连接sql server2008遇到的问题之一解决了。
java连接sql server2008遇到的问题之二:严重:此驱动程序不支持Java Runtime Environment(JRE)1.6版。
请使用支持JDBC4.0的sqljdbc4.jar,运行成功!背景:在使用java连sql server2008时,遇到的问题。
分析:数据库驱动问题。
解决方法:下载Microsoft SQL Server JDBC Driver2.0.据官方说明,支持sql2000/sql2005/sql2008必须确保CLASSPATH语句仅包含一个Microsoft SQL Server JDBC driver,例如sqljdbc.jar或sqljdbc4.jar。
sqljdbc4.jar类库要求使用6.0或更高版本的Java运行时环境(JRE)。
前提准备:mssql 2008已安装好了一个实例(我按默认情况下安装的实例是:SQLEXPRESS),并安装了SQL Server Management Studio工具。
为了满足可以用(local)或IP地址登录2008,需要以下配置支持:
一、打开“SQL Server 配置管理器”,做如下配置:
1、点开“SQL Server服务”节点
找到我们安装的SQL服务:SQL SERVER(SQLEXPRESS),双击它打开属性设置对话框,把登录身份中的内置帐户选中,并下拉选择“Network Service”:它的意思是用于网络服务,这样一来可以远程的客户端就可以重启这个SQL Server服务了,要不然重启服务功能只限于本机。
2、点开“SQL Server网络配置”节点。
再点开“实例名的协议”(我的是SQLEXPRESS的协议)。
能看到我的实例是支持Share Memory, Named Pipes, TCP/IP, VIA这几种协议的。
右键点击“TCP/IP”选择启用。
再右键它选择属性,在属性对话框中,切换到“IP地址”卡片,能看到有“IP1”,“IP2”...“IPAll”这几类针对IP的设置信息。
首先,因为我们目前用不上“TCP动态端口”的功能,所以把这几类IP的TCP动态端口全设置为空(如果是0的话则表示启用动态端口功能)。
再因为我准备把SQLEXPRESS实例向外提供服务的端口设置为1433(和SQL2000的默认服务连接端口号保持一致性),所以需要针对各类IP把它们的TCP 端口一项设置为1433(其实仅仅只需要把IPALL的TCP端口号设置为1433,其它类型的均为空即可)。
再把各类IP的“活动”和“已启用”均设置为“是”。
点击“确定”保存配置。
3、点开“SQL Native Client 10.0配置”节点(如果没有的话,可能是你的软件安装得有问题,或者没有安装客户端工具:SQL Server Management Studio)。
再点击“客户端协议”,找到“TCP/IP”,双击它打开属性对话框,设置“默认端口”为1433(和上面配置的端口号只要保持一致即可),设置“已启用”为“是”。
点击确定保存配置。
4、重启SQLEXPRESS实例。
二、打开SQL Server Management Studio工具
在连接到服务器操作对话框中做如下配置:
服务器类型:数据库引擎
服务器名称:(local) 或IP地址或. 补充:.的意思也是表示本机的意思
再点击右下角的“选项>>”按钮,切换到“连接属性”卡片,在网络协议一项配置中下拉选择“TCP/IP”
点击连接按钮即可。
打开可以用SA登录的方法
如果不打开一个用户(不一定必须是SA),那么对于不在服务器上的远程客户端工具就没办法连这个SQL Server服务器了。
一、先用SQL Server Management Studio工具登录服务器SQLEXPRESS实例(不论是用IP登录方式还是计算机名登录的方式)。
二、在根节点上右键打开属性对话框,找到“安全性”节点,打开它,再设置“服务器身份验证”为“SQL Server和Windows身份验证模式”,再点击确定保存配置。
三、展开:根节点->安全性->登录名->sa. 右键sa打开属性对话框。
1、在“常规”页中设置sa用户的密码,注意密码不能太简单,如密码是sa肯定是通过不了的。
2、在“用户映射”页中,确认一下SA用户有没有db_owner角色身份。
必须要有,要不然sa登录后什么高级功能也做不了了。
3、在“状态”页中,把“是否允许连接到数据库引擎”设置为“授予”,把“登录”设置
为“启用”。
4、点击确定保存配置。
四、接下来你就可以用SA用户尝试登录了。
这和Sql Server2000就很相似了。