您好我正在编写一个简单的控制台应用程序,使用批量复制将XML数据保存到数据库中,但目前我在连接数据库时遇到问题。
我收到SqlException错误:
发生与网络相关或特定于实例的错误 建立与SQL Server的连接。找不到服务器或 无法访问。验证实例名称是否正确 SQL Server配置为允许远程连接。 (提供者:命名 管道提供程序,错误:40 - 无法打开与SQL Server的连接)
我检查了确保我的SQL服务器正在运行并且配置正确的问题。下面是我的连接字符串。
string connectionString = @"Data Source=SYAZANA;Initial Catalog=WangSCM;integrated security=true;" ;
我正在努力弄清楚错误,我正在犯的错误是什么?
答案 0 :(得分:2)
按照以下步骤操作:
*转到SQL Server配置管理器
* SQL Server网络配置:
* MSSQLSERVER协议
*在右侧窗格拆分页面中,您必须按如下方式禁用VIA
--->共享内存 - 启用
--->命名管道 - 启用
---> TCP / IP - 启用
---> VIA - 禁用
或尝试以下
转到开始 - >在搜索类型| id | name | points |
|----|-------|--------|
| 3 | Three | 12 |
| 1 | One | 6 |
| 2 | Two | 5 |
中。在那里,您可以找到系统中提供的服务。
寻找 - > SQL EXPRESS / Services.msc
- >右键单击它 - >然后开始它。
如果它已经在开始。只需停止和开始,或只是重新启动。
答案 1 :(得分:2)
我发现以下技术很有用:
• Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration • Click on Surface Area Configuration for Services and Connections • Select the instance that is having a problem > Database Engine > Remote Connections • Enable local and remote connections • Restart instance
• If you are not using a domain account as a service account (for example if you are using NETWORK SERVICE), you may want to switch this first before proceeding
• Usually the format needed to specify the database server is machinename\instancename • Check your connection string as well • If SQL Server is not configured on the default port (1433) then mention that port in the connection string
• Start > Run > Firewall.cpl • Click on exceptions tab • Add the sqlservr.exe (typically located in C:\Program Files (x86)\Microsoft SQL Server\MSSQL.x\MSSQL\Binn), and port (default is 1433) • Check your connection string as well
检查您的SQL服务器服务是否正常运行。
检查您是否已连接到SQL Server。请注意您用于连接的内容:计算机名称,域名或IP地址?检查连接时使用此选项。例如,如果您使用的是myserver
• Start > Run > cmd • netstat -ano| findstr 1433 • telnet myserver 1433 • ping myserver
• Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> Select TCP/IP • Right Click on TCP/IP >> Click on Enable • You must restart SQL Server Services for all the changes to take effect.
• Open "SQL Server Configuration Manager" • Click on "SQL Server Network Configuration" and Click on "Protocols for Name" • Right Click on "TCP/IP" (make sure it is Enabled) Click on Properties • Select "IP Addresses" Tab -and- Go to the last entry "IPAll" • Enter "TCP Port" 1433.
答案 2 :(得分:0)
我遇到了同样的问题,由于某种原因,我不得不添加标准的SQL端口(1433),然后一切都恢复了。在你的情况下:
driver.execute_script("document.getElementById('overridelink').click()")
driver.get "javascript:document.getElementById('overridelink').click()"
driver.get("javascript:document.getElementById('overridelink').click()");