My server name now is AVI-PC\SQLEXPRESS
and it is working, I want to add an other host to the SQL Server.
I want to add sqllocalhost\SQLEXPRESS
.
So I went to etc/host and added the following line:
127.0.0.1 sqllocalhost
but I could not connect.
So I ping to AVI-PC
and I got the following address: fe80::bdc4:33a7:b403:d7f6%10
.
So I tried to add
fe80::bdc4:33a7:b403:d7f6%10 sqllocalhost
and still not working.
(I have restart the server and the PC).
Edit
开发者_开发技巧This is the config:
this is the exception:
===================================
Cannot connect to sqllocalhost.
===================================
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider)
You want to create an SQL Server alias. Right?
Let's say you have SEXYMF-PC\SQLEXPRESS And you want to connect to that server with a different name: dev\SQLEXPRESS
To do that you need to go to Start > All Programs > Microsoft SQL Server 2008 > Configuration Tools > SQL Server Configuration Manager
Once it opens you will see:
- SQL Native Client 10.0 Configuration
- Client Protocols
- Aliases
Right-click on Aliases and click on New Alias. There you enter
- Alias Name = dev\SQLEXPRESS
- Port No =
- Protocol = TCP/IP
- Server = SEXYMF-PC\SQLEXPRESS
Click ok and thats it. You can now connect to your SEXYMF-PC\SQLEXPRESS using dev\SQLEXPRESS
EDIT: Can you connect to "SEXYMF-PC\SQLEXPRESS" using SQL Server Management Studio? If yes, there try to connect to your alias name: dev\SQLEXPRESS. Does it work?
Concerning this message: (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) 1. Check if you have your SQL SErver Browser service on 2. Check again SQL Server Configuration Manager under - SQL Native Client 10.0 Configuration > Client Protocols > Named Pipes - and set to Enabled (if it is disabled).
精彩评论