SQL数据库连接失败的解决办法

合集下载

解决SQL2000数据库连接失败

解决SQL2000数据库连接失败

解决此问题有两种方法:第一种方法先停止服务器服务,双击主机屏幕右下角的的图标,弹1. 出界面选停止,再弹出的选项选择是。

2.解压data压缩包(没有的可以咨询售后服务人员),复制文件夹里所有文件,然后进入D盘,D:\Program Files\MicrosoftSQLServer\MSSQL\Data 这个路径,粘贴刚才复制的所有文件,提示替换时选全部。

重新点击这个图标,弹出界面选,开始/3.继续,等图标变成绿色三角即可关掉。

重新打开管理系统即可正常使用。

1第二种方法第一步:首先打开企业管理器,位置:服务器这台机器(也就是主机)开始-程序-Microsoft SQL Server-企业管理器依次点开-控制台根目录- Microsoft SQL Server- Microsoft SQL组-(local)(Windows NT)-安全性-登录2sa项目,双击,弹出界面然后选中右面出现的,1步数据库选项选成myhis第2步密码选项删除掉密码,然后点保存第弹出选项不填写,直接点确定。

此时,如果点确定之后界面直接消失,则程序可以正常使用了。

就不需要操作第二步了。

第二步如果弹出3错误2812:未能找到存储过程'sp_password'字样服务器这台机器(也就是主机)开始,位置:查询分析器”“则打开-程序-Microsoft SQL Server-查询分析器弹出界面如下图,直接点确定进入,如果提示错误,则选中SQL Server身份验证(Q)再点确定进入4弹出界面如下在红线箭头位置的光标处粘贴如下代码create procedure sp_password@old sysname = NULL, -- the old (current) password@new sysname, -- the new password@loginame sysname = NULL -- user to change password onas-- SETUP RUNTIME OPTIONS / DECLARE VARIABLES --set nocount on5declare @self intselect @self = CASE WHEN @loginame is null THEN 1 ELSE 2 END -- RESOLVE LOGIN NAMEif @loginame is nullselect @loginame = suser_sname()-- CHECK PERMISSIONS (SecurityAdmin per Richard Waymire) -- IF (not is_srvrolemember('securityadmin') = 1)AND not @self = 1begindbcc auditevent (107, @self, 0, @loginame, NULL, NULL, NULL) raiserror(15210,-1,-1)return (1)endELSEbegindbcc auditevent (107, @self, 1, @loginame, NULL, NULL, NULL) end-- DISALLOW USER TRANSACTION --set implicit_transactions offIF (@@trancount > 0)beginraiserror(15002,-1,-1,'sp_password')return (1)end-- RESOLVE LOGIN NAME (disallows nt names)if not exists (select * from whereloginname = @loginame and isntname = 0)beginraiserror(15007,-1,-1,@loginame)return (1)end-- IF non-SYSADMIN ATTEMPTING CHANGE TO SYSADMIN, REQUIRE PASSWORD (218078) --if (@self <> 1 AND is_srvrolemember('sysadmin') = 0 AND exists (SELECT * FROM WHERE loginname = @loginame and isntname = 0AND sysadmin = 1) )SELECT @self = 1-- CHECK OLD PASSWORD IF NEEDED --if (@self = 1 or @old is not null)if not exists (select * fromwhere srvid IS NULL andname = @loginame and6( (@old is null and password is null) orEND)) 0 1 ELSE WHEN (CASE xstatus&2048 = 2048 THEN (pwdcompare(@old, password,= 1) ) )beginraiserror(15211,-1,-1)return (1)end-- CHANGE THE PASSWORD --updategetdate(), = convert(varbinary(256), pwdencrypt(@new)), xdate2 set password =xstatus = xstatus & (~2048)where name = @loginame and srvid IS NULL-- UPDATE PROTECTION TIMESTAMP FOR MASTER DB, TO INDICATE SYSLOGINS CHANGE --exec('use master grant all to null')-- FINALIZATION: RETURN SUCCESS/FAILURE --if @@error <> 0return (1)raiserror(15478,-1,-1)return (0) -- sp_password粘贴完毕后,点击红圈里的绿色三角的运行符号,提示命令已成功完成。

SQLServer数据库连接失败错误及解决方法

SQLServer数据库连接失败错误及解决方法

SQLServer数据库连接失败错误及解决方法SQL Server 自带的客户端工具(以企业管理器为例)连接SQL Server时,最常见的错误有如下一些:1、SQL Server 不存在或访问被拒绝ConnectionOpen (Connect())2、用户'sa'登录失败。

原因:未与信任SQL Server 连接相关联。

3、超时已过期。

下面我们依次介绍如何来解决这三个最常见的连接错误。

第一个错误“SQL Server 不存在或访问被拒绝“通常是最复杂的,错误发生的原因比较多,需要检查的方面也比较多。

一般说来,有以下几种可能性:1、SQL Server名称或IP地址拼写有误;2、服务器端网络配置有误;3、客户端网络配置有误。

要解决这个问题,我们一般要遵循以下的步骤来一步步找出导致错误的原因。

首先,检查网络物理连接:ping 服务器IP地址或者ping 服务器名称如果ping 服务器IP地址失败,说明物理连接有问题,这时候要检查硬件设备,如网卡、HUB、路由器等。

还有一种可能是由于客户端和服务器之间安装有防火墙软件造成的,比如ISA Server。

防火墙软件可能会屏蔽对ping、telnet 等的响应,因此在检查连接问题的时候,我们要先把防火墙软件暂时关闭,或者打开所有被封闭的端口。

如果ping 服务器IP地址成功而ping 服务器名称失败,则说明名字解析有问题,这时候要检查DNS 服务是否正常。

有时候客户端和服务器不在同一个局域网里面,这时候很可能无法直接使用服务器名称来标识该服务器,这时候我们可以使用HOSTS文件来进行名字解析,具体的方法是:1、使用记事本打开HOSTS文件(一般情况下位于C:\WINNT\system32\drivers\etc).2、添加一条IP地址与服务器名称的对应记录,如:172.168.10.24 myserver也可以在SQL Server 的客户端网络实用工具里面进行配置,后面会有详细说明。

SQL Server数据库连接失败错误及解决方法

SQL Server数据库连接失败错误及解决方法

SQL Server数据库连接失败错误及解决方法在使用SQL Server 的过程中,用户遇到的最多的问题莫过于连接失败了。

一般而言,有以下两种连接SQL Server 的方式,一是利用SQL Server 自带的客户端工具,如企业管理器、查询分析器、事务探查器等;二是利用用户自己开发的客户端程序,如ASP 脚本、VB程序等,客户端程序中又是利用ODBC 或者OLE DB 等连接SQL Server。

下面,我们将就这两种连接方式,具体谈谈如何来解决连接失败的问题。

一、客户端工具连接失败在使用SQL Server 自带的客户端工具(以企业管理器为例)连接SQL Server时,最常见的错误有如下一些:1、SQL Server 不存在或访问被拒绝ConnectionOpen (Connect())2、用户'sa'登录失败。

原因:未与信任SQL Server 连接相关联。

3、超时已过期。

下面我们依次介绍如何来解决这三个最常见的连接错误。

第一个错误"SQL Server 不存在或访问被拒绝"通常是最复杂的,错误发生的原因比较多,需要检查的方面也比较多。

一般说来,有以下几种可能性:1、SQL Server名称或IP地址拼写有误;2、服务器端网络配置有误;3、客户端网络配置有误。

要解决这个问题,我们一般要遵循以下的步骤来一步步找出导致错误的原因。

首先,检查网络物理连接:ping <服务器IP地址>或者ping <服务器名称>如果ping <服务器IP地址> 失败,说明物理连接有问题,这时候要检查硬件设备,如网卡、HUB、路由器等。

还有一种可能是由于客户端和服务器之间安装有防火墙软件造成的,比如ISA Server。

防火墙软件可能会屏蔽对ping、telnet 等的响应,因此在检查连接问题的时候,我们要先把防火墙软件暂时关闭,或者打开所有被封闭的端口。

SQLServer数据库连接失败错误及解决方法

SQLServer数据库连接失败错误及解决方法

SQL ‎S erve‎r数据库连‎接失败错误‎及解决方法‎在使用‎SQL ‎S erve‎r的过程‎中,用户遇‎到的最多的‎问题莫过于‎连接失败了‎。

一般而言‎,有以下两‎种连接S‎Q L Se‎r ver ‎的方式,一‎是利用S‎Q L Se‎r ver ‎自带的客户‎端工具,如‎企业管理器‎、查询分析‎器、事务探‎查器等;二‎是利用用户‎自己开发的‎客户端程序‎,如ASP‎脚本、V‎B程序等,‎客户端程序‎中又是利用‎ODBC‎或者O‎L E DB‎等连接‎S QL S‎e rver‎。

下面,我‎们将就这两‎种连接方式‎,具体谈谈‎如何来解决‎连接失败的‎问题。

‎一、客户‎端工具连接‎失败‎在使用‎S QL S‎e rver‎自带的客‎户端工具(‎以企业管理‎器为例)连‎接SQL‎Serv‎e r时,最‎常见的错误‎有如下一些‎:‎1、SQL‎Serv‎e r 不存‎在或访问被‎拒绝‎Conn‎e ctio‎n Open‎(Con‎n ect(‎))‎‎2、用‎户'sa'‎登录失败。

‎原因:未与‎信任SQ‎L Ser‎v er 连‎接相关联。

‎‎3‎、超时已过‎期。

‎‎下面我们‎依次介绍如‎何来解决这‎三个最常见‎的连接错误‎。

‎第一个错误‎"SQL ‎S erve‎r不存在‎或访问被拒‎绝"通常是‎最复杂的,‎错误发生的‎原因比较多‎,需要检查‎的方面也比‎较多。

一般‎说来,有以‎下几种可能‎性:‎1、SQ‎L Ser‎v er名称‎或IP地址‎拼写有误;‎2‎、服务器端‎网络配置有‎误;‎3、客户‎端网络配置‎有误。

‎要解决‎这个问题,‎我们一般要‎遵循以下的‎步骤来一步‎步找出导致‎错误的原因‎。

‎首先,检查‎网络物理连‎接:‎ping‎<服务器‎I P地址>‎或‎者‎p ing ‎<服务器名‎称>‎如果p‎i ng <‎服务器IP‎地址> 失‎败,说明物‎理连接有问‎题,这时候‎要检查硬件‎设备,如网‎卡、HUB‎、路由器等‎。

1、 数据库连接失败的原因以及解决的方法

1、 数据库连接失败的原因以及解决的方法

1、数据库连接失败的原因以及解决的方法
连接失败的
原因
错误提示解决方法
服务器端数
据库未
启动错误提示:数据库连接失败解决方法:重新启动服务器端数据库,启动后服务器右下角任务栏会出现
图标,表示数据库已经启动。

服务器名不
正确错误提示:数据库连接失败解决方法:检查数据库名是否正确。

比如说服务器端的叫server,
那么客户端连接的服务器名必须是server.具体的方法是在服务器端
右下端用鼠标放在上面,可以显示出其名字。

客户端版本与数据库版本不一致解决方法:检查数据库版本(比如数据库是07III版的,客户端也必须是07III版)具体的方法是点击鼠标右键→属性→目标(T)可以看到客户端和数据库的安装路径以及版本号等详细信息
局域网不连
通解决方法:检查客户端电脑与服务器端电脑局域网是否连通。

方法是:把服务器端设置一个IP地址,在客户端用Ping命令ping 服务器IP. 在服务器端ping客户端IP。

如果能ping通,表示网络畅通,如果其中某一台客户端ping不通,检查其网线是否插好,该客户端的IP是
否在局域网的IP地址网段范围之内。

防火墙的阻

解决方法:如果是系统默认防火墙,从“开始”→“设置”→“控制面版”
→“防火墙”,关掉服务器端和客户端防火墙再重新登陆客户端连接数据库。

如果安装了其他的防火墙,可以关闭其防火墙。

未注册客户
端使用
期限已

解决方法:与我司联系将客户端注册。

SQL数据库连接失败的解决办法

SQL数据库连接失败的解决办法

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。

SQL 数据库无法连接问题

SQL  数据库无法连接问题
可以用如下的方式查看MSSQLቤተ መጻሕፍቲ ባይዱ版本:
打开企业管理器-〉工具-〉SQL查询分析器-〉帮助-〉关于
查看MSSQL的详细版本号
如果 是 8.00.194 就是还没打补丁
8.00.760 就是SP3
8.00.2039 就是SP4
1、下载MSSQL 2000 Service Pack 3a并安装,SQL请选用混和安装模式!!!
要保持jdbc配置语句( jdbc:microsoft:sqlserver://server_name:1433)中的端口与数据库传输协议默认的端口相同。
MSSQL设置端口号步骤如下:
1. 打开企业管理器,依次在控制台根目录 ->Microsoft SQL Servers->SQL Server 组,列出一部分数据库服务器。
四 系统防火墙或者杀毒软件
如果系统开防火墙或者杀毒软件,在有些情况下也可以出现类似的问题。
没有遇见过,有人这么说。
可能我查询的未必全面,如果你的解决方式不同,可以给我留言,一起完善其解决方法.
/downloads/details.aspx?FamilyId=90DCD52C-0488-4E46-AFBF-ACACE5369FA3&displaylang=zh-cn
解压缩sp3的升级包后,还要点击setup安装.才能成功升级到sp3。
2. 右击我们要连接的数据库服务器,选择属性,在常规选项卡点击网络配置弹出新窗口。
3. 在启用的协议区域我们选择 TCP/IP ,点击属性按钮,弹出新窗口。在这个窗口有网络协议默认值设置,一般默认端口是:1433。 如果你在url中用的端口号与这个不同,就会出现错误。应保持二者相同。

sqlstate[hy000] [2002] connection refused翻译

sqlstate[hy000] [2002] connection refused翻译

"sqlstate[hy000] [2002] connection refused" 是一个数据库连接错误信息。

•sqlstate[hy000]是一个状态码,表示一个通用的SQL错误。

•[2002]是MySQL的错误代码,表示“连接被拒绝”。

•connection refused的意思是“连接被拒绝”。

综合这些信息,这个错误信息意味着:尝试连接到数据库时被拒绝了连接。

这可能是由以下原因导致的:
1.服务器未运行:你试图连接的数据库服务器可能没有运行或有其他问题。

2.网络问题:你的应用程序和数据库服务器之间的网络连接可能存在问题。

3.防火墙或安全组规则:可能存在防火墙或安全组规则,阻止了你的应用程
序与数据库服务器之间的连接。

4.错误的连接参数:例如,你可能使用了错误的用户名、密码、主机名或端
口号来尝试连接。

为了解决这个问题,你可以检查:
1.数据库服务器的状态和日志,以确保它正在运行并接受连接。

2.网络连接和防火墙设置,确保它们允许你的应用程序与数据库服务器之间
的通信。

3.确保你的应用程序使用的连接参数是正确的。

SQL Server数据库连接失败错误及解决方法

SQL Server数据库连接失败错误及解决方法

SQL Server数据库连接失败错误及解决方法在使用SQL Server 的过程中,用户遇到的最多的问题莫过于连接失败了。

一般而言,有以下两种连接SQL Server 的方式,一是利用SQL Server 自带的客户端工具,如企业管理器、查询分析器、事务探查器等;二是利用用户自己开发的客户端程序,如ASP 脚本、VB程序等,客户端程序中又是利用ODBC 或者OLE DB 等连接SQL Server。

下面,我们将就这两种连接方式,具体谈谈如何来解决连接失败的问题。

一、客户端工具连接失败在使用SQL Server 自带的客户端工具(以企业管理器为例)连接SQL Server时,最常见的错误有如下一些:1、SQL Server 不存在或访问被拒绝ConnectionOpen (Connect())2、用户'sa'登录失败。

原因:未与信任SQL Server 连接相关联。

3、超时已过期。

下面我们依次介绍如何来解决这三个最常见的连接错误。

第一个错误"SQL Server 不存在或访问被拒绝"通常是最复杂的,错误发生的原因比较多,需要检查的方面也比较多。

一般说来,有以下几种可能性:1、SQL Server名称或IP地址拼写有误;2、服务器端网络配置有误;3、客户端网络配置有误。

要解决这个问题,我们一般要遵循以下的步骤来一步步找出导致错误的原因。

首先,检查网络物理连接:ping <服务器IP地址>或者ping <服务器名称>如果ping <服务器IP地址> 失败,说明物理连接有问题,这时候要检查硬件设备,如网卡、HUB、路由器等。

还有一种可能是由于客户端和服务器之间安装有防火墙软件造成的,比如ISA Server。

防火墙软件可能会屏蔽对ping、telnet 等的响应,因此在检查连接问题的时候,我们要先把防火墙软件暂时关闭,或者打开所有被封闭的端口。

SQL连接ORACLE异常解决方案

SQL连接ORACLE异常解决方案

SQL连接ORACLE异常解决方案Oracle数据库是一款常用的关系型数据库管理系统,广泛应用于企业级应用开发中。

在使用SQL连接Oracle过程中,常常会遇到一些异常情况,如无法连接数据库、连接超时等问题。

本篇文章将就SQL连接Oracle异常进行详细的解决方案介绍。

1.无法连接到数据库当SQL无法连接到Oracle数据库时,首先要检查以下几个方面:- 网络连接是否正常:确认网络连接是否正常,尝试ping数据库服务器的IP地址,检查是否可以正常访问。

- Oracle数据库是否启动:确认Oracle数据库是否已经启动,可以使用命令`lsnrctl status`来查看监听器的状态,如果监听器没有启动,可以使用`lsnrctl start`启动监听器。

- TNS配置是否正确:确认TNS配置文件(一般为tnsnames.ora)中数据库实例的配置是否正确,如数据库地址、端口等。

- 防火墙是否阻止访问:检查防火墙设置,确保Oracle数据库端口没有被阻止。

2.连接超时在连接数据库时,可能出现连接超时的情况。

解决连接超时的方法有以下几种:-调整网络延迟设置:如果是由于网络延迟问题导致的连接超时,可以尝试调整操作系统的网络延迟设置,或者调整网络路由器的参数,以降低网络延迟。

- 检查数据库是否正常响应:连接超时可能是由于Oracle数据库响应速度过慢导致的,可以使用命令`sqlplus / as sysdba`连接数据库,检查数据库的健康状态。

3.连接断开在使用SQL连接Oracle时,可能会遇到连接断开的情况,无法执行任何SQL语句。

为了解决连接断开的问题,可以采取以下措施:-检查数据库连接池配置:如果使用数据库连接池连接数据库,可以检查连接池的配置参数,例如最大连接数、空闲连接时间等,调整相关参数。

- 检查数据库日志:连接断开可能是由于数据库内部发生错误导致的,可以查看数据库日志(alert.log),确认数据库是否有相关报错信息。

SQL数据库连接到服务器出错——无法连接到XXX

SQL数据库连接到服务器出错——无法连接到XXX

SQL数据库连接到服务器出错——⽆法连接到XXX 问题:Windows或者SQL Server⾝份验证下,出现连接到服务器出错
解决⽅式:
1.检查实例名称是否正确,如下
根据⾃⼰电脑的实际名称修改修改如下:
1)Microsoft SQL Server Management Studio是正式版的:
2)Microsoft SQL Server Management Studio是⾮正式版的,则填:
连接成功如下:
2.如果还是没连上,在服务器名称正确的基础上,检查系统SQL服务是否开启:
1)在运⾏⾯板输⼊ services.msc ,打开系统的服务⾯板。

2)右击以下界⾯处,点击启动选项或者重新启动
3)重新打开以下界⾯连接
3. 如果在上步骤还没连接上,就要检查SQL配置管理器中协议是否修改:
1)右击我的电脑,点击管理选项,打开计算机管理⾯板
2)把协议和都设置为开启,
3)把SQL服务重新启动⼀下
4)最后再重新打开Microsoft SQL Server Management Studio界⾯连接数据库
Ps:根据以上三个位置的修改,SQL数据库连接问题基本解决。

由于各个系统配置的不同,可能SQL数据库连接问题也有差异,以后继续补充。

SQL数据库连接失败的解决办法

SQL数据库连接失败的解决办法

在使用SQ‎L Ser‎v er 的‎过程中,用‎户遇到的最‎多的问题莫‎过于连接失‎败了。

一般‎而言,有以‎下两种连接‎SQL ‎S erve‎r的方式‎,一是利用‎SQL ‎S erve‎r自带的‎客户端工具‎,如企业管‎理器、查询‎分析器、事‎务探查器等‎;二是利用‎用户自己开‎发的客户端‎程序,如A‎S P 脚本‎、VB程序‎等,客户端‎程序中又有‎利用 OD‎B C 或者‎OLE ‎D B 等连‎接 SQL‎Serv‎e r。

下面‎,我们将就‎这两种连接‎方式,具体‎谈谈如何来‎解决连接失‎败的问题。

‎一‎、客户端工‎具连接失败‎在‎使用 SQ‎L Ser‎v er 自‎带的客户端‎工具(以企‎业管理器为‎例)连接‎S QL S‎e rver‎时,最常见‎的错误有如‎下一些:‎1、‎S QL S‎e rver‎不存在或‎访问被拒绝‎‎Conn‎e ctio‎n Open‎(Con‎n ect(‎))‎‎2、用户'‎s a'登录‎失败。

原因‎:未与信任‎SQL ‎S erve‎r连接相‎关联。

‎3‎、超时已过‎期。

‎‎下面我们依‎次介绍如何‎来解决这三‎个最常见的‎连接错误。

‎第‎一个错误"‎S QL S‎e rver‎不存在或‎访问被拒绝‎"通常是最‎复杂的,错‎误发生的原‎因比较多,‎需要检查的‎方面也比较‎多。

一般说‎来,有以下‎几种可能性‎:‎1、SQL‎Serv‎e r名称或‎I P地址拼‎写有误;‎2、‎服务器端网‎络配置有误‎;3‎、客户端网‎络配置有误‎。

‎要解决这个‎问题,我们‎一般要遵循‎以下的步骤‎来一步步找‎出导致错误‎的原因。

‎首先‎,检查网络‎物理连接:‎p‎i ng <‎服务器IP‎地址>‎或‎者‎ping‎<服务器‎名称>‎如果‎p ing ‎<服务器I‎P地址>‎失败,说明‎物理连接有‎问题,这时‎候要检查硬‎件设备,如‎网卡、HU‎B、路由器‎等。

【VIP专享】SQL数据库连接常见错误的解决方法

【VIP专享】SQL数据库连接常见错误的解决方法

怎样解决SQL数据库连接错误很多人使用SQL数据库的时候经常会出现很多错误,这篇文章采用图文的形式给大家列出常见的错误及解决方法。

一、常见错误1错误一:错误信息erroe40,点击登录Sql时出现的错误。

1.错误二:错误信息erroe26,点击登录窗体时报出的错误,无法正常登录。

错误三:Microsoft Sql Sever 错误53,错误信息erroe40,无法正常登录。

错误四:Microsoft Sql Sever错误18456,无法正常登录错误五:出现异常,无法打开到SQL Sever的连接。

二、解决方法1.1错误一的原因:没有打开sql服务器。

解决办法:打开sql服务器。

步骤:右键点击【我的电脑】打开【管理】,点击【服务和应用程序】剩下步骤如图所示错误二的原因:选择错误的Sql服务器。

解决办法:查看刚才打开的数据库Sql Sever服务器名称,登录的时候选择它作为登录服务名称。

2.错误三的原因:输入错误的服务器名称,并且Sql Sever服务没有大概。

解决方法:这里有打开sql服务器的另一种方式,错误的服务器名称自己检查下修改下;打开服务器的另一种方法图示步骤如下:3.4错误四的原因:数据库没有给sa授权登录。

解决方法:先使用window身份验证登录,登录后点击,点击安全性,打开登录名,右键打开sa属性,在sa登录属性框里,点击状态,在登录框里选择启用项,确定后;断开连接,重新连接选择sa身份登录。

4.5错误五的原因:没有选择正确的sql服务。

断开重新选择连接,选择合适的服务。

解决方法:注意事项∙看清自己启动的是哪个服务(启动时候记住Sql Sever记住服务名称)∙登录是选择合适的登录身份验证用户。

SQL连接失败解决方案

SQL连接失败解决方案

如果ping <服务器IP地址> 成功而 ping <服务器名称>失败,则说明名字解析
有问题,这时候要检查 DNS 服务是否正常。有时候客户端和服务器不在同一个局域网里面,
这时候很可能无法直接使用服务器名称来标识该服务器,这时候我们可以使用HOSTS文件来进
1、使用记事本打开HOSTS文件(一般情况下位于C:WINNTsystem32driversetc)
在使用 SQL Server 的过程中,用户遇到的最多的问题莫过于连接失败了。一般而言
,有以下两种连接 SQL Server 的方式,一是利用 SQL Server 自带的客户端工具,如企业管
理器、查询分析器、事务探查器等;二是利用用户自己开发的客户端程序,如ASP 脚本、VB程
事实上,如果默认端口被修改,也是可以的,但是在客户端做telnet测试时,写服务器端口号时必须与服务器配置的端口号保持一致。如果隐藏服务器复选框被勾选,则意味着客户端无法通过枚举服务器来看到这台服务器,起到了保护的作用,但不影响连接,但是Tcp/ip协议的默认端口将被隐式修改为2433,在客户端连接时必须作相应的改变。
如果以上都没问题,这时你再做telnet 服务器ip 1433 测试,将会看到屏幕一闪之后光标在左上角不停闪动。恭喜你,你马上可以开始在企业管理器或查询分析器连接了。
三 检查客户端设置
程序->Microsoft SQL Server -> 客户端网络使用工具。像在服务器网络实用工具里一样,确保客户端tcp/ip协议启用,并且默认端口为1433(或其他端口,与服务器端保持一致就行)。
查询分析器->工具->选项->连接->在 登录超时(秒) 后面的框里输入一个较大的数字

SQL无法连接解决方案

SQL无法连接解决方案

SQL无法连接解决方案在使用SQL时,有时会遇到无法连接数据库的问题。

这些问题可能由多种原因引起,包括数据库配置错误、网络问题、权限问题等。

下面是几种常见的SQL无法连接问题及其解决方案。

1.数据库配置问题通过检查数据库配置文件确定数据库的连接信息是否正确。

特别要注意以下几个配置项:-主机名:确保主机名或IP地址正确。

-端口号:确认数据库使用的端口号是否正确。

-数据库名称:检查数据库名称是否正确。

-用户名和密码:确保使用的用户名和密码是正确的。

2.网络问题- 确保本地网络连接正常。

可以尝试ping数据库服务器的IP地址来检查网络连接是否通畅。

-检查数据库服务器的防火墙设置。

如果数据库服务器上的防火墙过滤了一些端口,可能导致无法连接数据库。

可以尝试关闭防火墙或将端口添加到白名单中。

3.权限问题-确保使用的用户名和密码具有足够的权限来连接数据库。

可以尝试使用管理员账号连接数据库来验证权限问题。

-检查数据库服务器配置,确保允许远程连接。

有些数据库默认只允许本地连接,需要手动修改配置文件启用远程连接。

4.数据库服务问题-确保数据库服务已经启动。

可以尝试重新启动数据库服务来解决问题。

-检查数据库服务器的错误日志,查看是否有相关错误信息。

错误日志通常位于数据库安装目录下的日志文件夹中。

5.编程语言或驱动程序问题-检查使用的编程语言或驱动程序是否正确配置。

一些编程语言或驱动程序需要特定的配置来连接数据库。

-确保使用的驱动程序版本与数据库版本兼容。

有时旧版本的驱动程序可能无法与最新版的数据库兼容,需要升级驱动程序或降级数据库版本。

6.其他问题-关闭和重新打开数据库连接。

有时数据库连接可能会因为一些未知的原因中断,关闭并重新打开连接可能有助于解决问题。

-重启计算机。

如果以上解决方案都无效,可以尝试重启计算机来清除可能导致问题的缓存或临时文件。

总之,SQL无法连接问题可能由多种原因引起,解决方法也各不相同。

建议根据具体情况逐一排查可能的原因,并采取相应的解决方案。

SQL连接不上的解决方法

SQL连接不上的解决方法

[DBNETLIB][ConnectionOpen(connect()).]SQL Server不存在或拒绝访问一台机器即作服务器又作客户机,软件连接中出现:[DBNETLIB][ConnectionOpen(connect()).]SQL Server不存在或拒绝访问。

现从网上查阅问题解决办法有如下几种:(A)1:你如果是独立上网的请把21端口打开.局域网把1433端口打开就可以了.2;关闭防火墙!(B)把数据库连接的SqlLocalName="(local)"的(local)改成IP试试。

可以把(local)该成127.0.0.1,或者改成外网IP(C)打开服务,暂停全文检索及sql server服务开启sql server服务再开启全文检索服务(D)SQL Server右键属性==>安全选项中的“所有权链接:”“允许跨数据库所有权链接”前面的勾要勾上(此操作需要重起SQL Server)。

2、你的问题我也出现过,我是两台电脑组成局域网,一台做网站服务器另一台为数据库服务器,配置为WIN2003-SP1+MS SQL-SP3,网站服务器直接连接外网,数据库服务器通过网站服务器连外网。

刚开机的时候一切运行正常,但是没过多久就会出现上面的情况,后来检查发现原来是数据库服务器的防火墙开着呢,当时是为了防止外界攻击才设的,我在防火墙上开了1433端口后试了下还不行,后来关掉防火墙,并关闭网站服务器的INTERNET共享。

然后运行,发现一切正常了。

5、Sql Server远程连接数据库时发生“[DBNETLIB][ConnectionOpen(connect()).]SQL Server 不存在或拒绝访问”的情况,原因有很多种,一般情况都是用过检查:1、防火墙;2、1433端口;来排除故障,但今天发现有以下情况同样会造成这个现象。

排除过程:1、检查防火墙设置和1433端口设置正确;2、如果出现“找不到网络路径”的报错,那么最好先PING一下它的IP地址。

sqlserver数据库连接错误解决方案

sqlserver数据库连接错误解决方案

日志总结项目搭建一、项目搭建:1、先把所需的jar全部找到,导入lib中。

2、把数据库的驱动包(所需包根据所选数据库而定)导入。

3、设置配置文件4、建立测试类二、项目搭建,测试时的错误:ng.IllegalStateException: Failed to load ApplicationContextCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-common.xml]: Invocation of init method failed; nested exception is ng.AbstractMethodError:com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGeneratedKeys()Z Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-common.xml]: Invocation of init method failed; nested exception is ng.AbstractMethodError:com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGeneratedKeys()Z Caused by: ng.AbstractMethodError:com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGeneratedKeys()Z 解决方案:Caused by: ng.AbstractMethodError:com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGeneratedKeys()Z 解决了,原来是JDBC驱动不行,上面红线部门讲的SQL SERVER2000的驱动名,换成JTDS驱动就解决了数据库为sqlserver 2000,数据库的驱动包原来的驱动包是:msbase.jar、mssqlserver.jar、msutil.jarJTDS驱动包是:jtds-1.2.5.jar要点:原来的数据库URL:原来的驱动类:JTDS数据库URL:jdbc:jtds:sqlserver://localhost:1433;DatabaseName=数据库名驱动类:net.sourceforge.jtds.jdbc.Driver。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

1、点击"开始"-"运行",输入regedit,回车进入注册表编辑器;
2、依次展开注册表项,浏览到以下注册表键:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer]
3、在屏幕右方找到名称"LoginMode",双击编辑双字节值;
看完如何解决前两个错误的方法之后,让我们来看一下如图 3 所示的第三个错误。
如果遇到第三个错误,一般而言表示客户端已经找到了这台服务器,并且可以进行连接,不过是由于连接的时间大于允许的时间而导致出错。这种情况一般会发生在当用户在Internet上运行企业管理器来注册另外一台同样在Internet上的服务器,并且是慢速连接时,有可能会导致以上的超时错误。有些情况下,由于局域网的网络问题,也会导致这样的错误。
4、 重新启动SQL Server服务。
在以上解决方法中,如果在第 1 步中使用"使用 Windows 身份验证"连接 SQL Server 失败,那么我们将遇到一个两难的境地:首先,服务器只允许了 Windows 的身份验证;其次,即使使用了 Windows 身份验证仍然无法连接上服务器。这种情形被形象地称之为"自己把自己锁在了门外",因为无论用何种方式,用户均无法使用进行连接。实际上,我们可以通过修改一个注册表键值来将身份验证方式改为 SQL Server 和 Windows 混合验证,步骤如下所示:
2、在弹出的"SQL Server企业管理器属性"窗口中,点击"高级"选项卡;
3、在"连接设置"下的"登录超时(秒)"右边的框中输入一个比较大的数字,如 20。
查询分析器中也可以在同样位置进行设置。
二、应用程序连接失败
以上的三种错误信息都是发生在 SQL Server 自带的客户端工具中,在应用程序中我们也会遇到类似的错误信息,例如:
1、打开企业管理器,展开服务器组,然后展开服务器;
2、展开"安全性",右击"登录",然后单击"新建登录";
3、在"名称"框中,输入 BUILTIN\Administrators;
4、在"服务器角色"选项卡中,选择"System Administrators" ;
5、点击"确定"退出;
3、超时已过期。
下面我们依次介绍如何来解决这三个最常见的连接错误。
第一个错误"SQL Server 不存在或访问被拒绝"通常是最复杂的,错误发生的原因比较多,需要检查的方面也比较多。一般说来,有以下几种可能性:
1、SQL Server名称或IP地址拼写有误;
从上图中,我们可以看出在实际使用中,应用程序创建和使用各种 ADO 对象,ADO 对象框架调用享用的 OLE DB 提供者。为了访问 SQL Server 数据库,OLE DB 提供了两种不同的方法:用于 SQL Server 的 OLE DB 提供者以及用于 ODBC 的 OLE DB 提供者。这两种不同的方法对应于两种不同的连接字符串,标准的连接字符串写法如下所示:
检查完了服务器端的网络配置,接下来我们要到客户端检查客户端的网络配置。我们同样可以利用 SQL Server 自带的客户端网络使用工具来进行检查,所不同的是这次是在客户端来运行这个工具。
点击:程序 -> Microsoft SQL Server -> 客户端网络使用工具, 打开该工具后看到的画面如下图所示:
"User Id=myUsername;" & _
"Password=myPassword"
使用 Windows 身份验证(信任4;确定";
5、关闭注册表编辑器;
6、重新启动SQL Server服务。
此时,用户可以成功地使用sa在企业管理器中新建SQL Server注册,但是仍然无法使用Windows身份验证模式来连接SQL Server。这是因为在 SQL Server 中有两个缺省的登录帐户:BUILTIN\Administrators 以及 <机器名>\Administrator 被删除。要恢复这两个帐户,可以使用以下的方法:
从这里我们可以看到客户端启用了哪些协议。一般而言,我们同样需要启用命名管道以及 TCP/IP 协议。
点击 TCP/IP 协议,选择"属性",可以检查客户端默认连接端口的设置,如下图所示。
该端口必须与服务器一致。
单击"别名"选项卡,还可以为服务器配置别名。服务器的别名是用来连接的名称,连接参数中的服务器是真正的服务器名称,两者可以相同或不同。如下图中,我们可以使用myserver来代替真正的服务器名称sql2kcn-02,并且使用网络库 Named Pipes。别名的设置与使用HOSTS文件有相似之处。
用户 'sa' 登录失败。原因: 未与信任 SQL Server 连接相关联。
Microsoft OLE DB Provider for ODBC Drivers 错误 '80004005'.
[Microsoft][ODBC SQL Server Driver]超时已过期.
首先,让我们来详细看以下的示意图来了解一下使用 ODBC 和使用 OLE DB 连接 SQL Server 有什么不同之处。
2、服务器端网络配置有误;
3、客户端网络配置有误。
要解决这个问题,我们一般要遵循以下的步骤来一步步找出导致错误的原因。
首先,检查网络物理连接:
ping <服务器IP地址>
或者
ping <服务器名称>
如果 ping <服务器IP地址> 失败,说明物理连接有问题,这时候要检查硬件设备,如网卡、HUB、路由器等。还有一种可能是由于客户端和服务器之间安装有防火墙软件造成的,比如 ISA Server。防火墙软件可能会屏蔽对 ping、telnet 等的响应,因此在检查连接问题的时候,我们要先把防火墙软件暂时关闭,或者打开所有被封闭的端口。
1、使用用于 SQL Server 的 OLE DB 提供者:
使用 SQL Server 身份验证:
oConn.Open "Provider=sqloledb;" & _
"Data Source=myServerName;" & _
"Initial Catalog=myDatabaseName;" & _
如果命令执行成功,可以看到屏幕一闪之后光标在左上角不停闪动,这说明 SQL Server 服务器工作正常,并且正在监听1433端口的 TCP/IP 连接;如果命令返回"无法打开连接"的错误信息,则说明服务器端没有启动 SQL Server 服务,也可能服务器端没启用 TCP/IP 协议,或者服务器端没有在 SQL Server 默认的端口1433上监听。
通过以上几个方面的检查,错误 1 发生的原因基本上可以被排除。下面我们再详细描述如何来解决错误 2。
当用户尝试在查询分析器里面使用sa来连接SQL Server,或者在企业管理器里面使用sa来新建一个SQL Server注册时,经常会遇到如图 2 所示的错误信息。该错误产生的原因是由于SQL Server使用了"仅 Windows"的身份验证方式,因此用户无法使用SQL Server的登录帐户(如 sa )进行连接。解决方法如下所示:
从这里我们可以看到服务器启用了哪些协议。一般而言,我们启用命名管道以及 TCP/IP 协议。
点中 TCP/IP 协议,选择"属性",我们可以来检查 SQL Server 服务默认端口的设置,如下图所示:
一般而言,我们使用 SQL Server 默认的1433端口。如果选中"隐藏服务器",则意味着客户端无法通过枚举服务器来看到这台服务器,起到了保护的作用,但不影响连接。
如果ping <服务器IP地址> 成功而 ping <服务器名称> 失败,则说明名字解析有问题,这时候要检查 DNS 服务是否正常。有时候客户端和服务器不在同一个局域网里面,这时候很可能无法直接使用服务器名称来标识该服务器,这时候我们可以使用HOSTS文件来进行名字解析,具体的方法是:
1、使用记事本打开HOSTS文件(一般情况下位于C:\WINNT\system32\drivers\etc).
一、客户端工具连接失败
在使用 SQL Server 自带的客户端工具(以企业管理器为例)连接 SQL Server时,最常见的错误有如下一些:
1、SQL Server 不存在或访问被拒绝
ConnectionOpen (Connect())
2、用户'sa'登录失败。原因:未与信任 SQL Server 连接相关联。
在使用SQL Server 的过程中,用户遇到的最多的问题莫过于连接失败了。一般而言,有以下两种连接 SQL Server 的方式,一是利用 SQL Server 自带的客户端工具,如企业管理器、查询分析器、事务探查器等;二是利用用户自己开发的客户端程序,如ASP 脚本、VB程序等,客户端程序中又有利用 ODBC 或者 OLE DB 等连接 SQL Server。下面,我们将就这两种连接方式,具体谈谈如何来解决连接失败的问题。
1、 在服务器端使用企业管理器,并且选择"使用 Windows 身份验证"连接上 SQL Server;
2、 展开"SQL Server组",鼠标右键点击SQL Server服务器的名称,选择"属性",再选择"安全性"选项卡;
相关文档
最新文档