RE: Resolving an IP address from a SQL Server Instance Name
- From: "MrSmersh" <MrSmersh@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 23 Jan 2006 06:04:02 -0800
Since in this manner we will not going fast I will try to spill the bucket of
ideas.
Please take time to read it all this post, which will be rather big.
And please let me know if it worked.
· First
>From msdn blog
An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to
SQL Server)
Troubleshoot:
1) Make sure your sql service is running, use either "net start" or "sc
query <InstanceName>" or run services.msc, check status of the server; If
server start fail, go to ERRORLOG to see what happened there, fix the problem
and restart server.
2) You might explicitly use "np:"prefix which ask for connect through named
pipe. However, client can not connect to server through the pipe name that
specified.Double check the server is started and listening on named pipe if
you enabled Named Pipe. One way is that see the ERRORLOG of the server,
search follow keywords:
Server named pipe provider is ready to accept connection on [
\\.\pipe\sql\query ] or [\\.\pipe\mssql$<InstanceName>\sql\query]
Notice that "sql\query" is the default pipe name, so you need to know server
is listening on which pipe name. eg: if you specify server pipe name is
"sql\query1", then you would see in the errorlog that server listening on [
\\.\pipe\sql\query1 ], and go to SQL Server Configuration Manager, click
client Named Pipe properties, see whether the pipe name is same with the one
server listening on.
3) You might specify named pipe protocol in connection string, but did not
enable named pipe on the server, check ERRORLOG.
4) You might use FQDN/IPAddress/LoopbackIP to connect to the server when
only shared memory was enabled, you can change to <machinename> to resolve
this.
5) You might explictly specify "lpc:" prefix in your connection string, but
shared memory was not enabled. To resolve this, either remove the prefix as
long as named pipe or tcp was enabled or enable shared memory.
· Second
Add the ip and computer to the host file located in
C:\WINDOWS\system32\drivers\etc.
· Third
To get the ip from computer name, import the System.Net namespace there from
Dns namespace you have the method GetHodtByName. That method resolves host
names in to IPs. You have of usage samples in the help.
"Kevin Yu [MSFT]" wrote:
> Hi Michael,
>
> Can you try to disable Named Pipes and try to connect using TCP/IP?
>
> Kevin Yu
> =======
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
>
>
.
- References:
- RE: Resolving an IP address from a SQL Server Instance Name
- From: michael
- RE: Resolving an IP address from a SQL Server Instance Name
- From: Kevin Yu [MSFT]
- RE: Resolving an IP address from a SQL Server Instance Name
- Prev by Date: Re: TableAdapter's TableMappings?
- Next by Date: Re: the difference between SqlConnection.IDisposable.Dispose() and SqlConnection.Dispose()
- Previous by thread: RE: Resolving an IP address from a SQL Server Instance Name
- Next by thread: Query to find profile data in aspnet_Profile
- Index(es):
Relevant Pages
|