Cannot connect to localhost

  • We cloned a windows 2008 server to create another test environment. We had no problems, or so it seemed, with the clone except we noticed that when we looked up the servername from within SQL Server 2008 we were still getting the old server name. To fix this we tried the following:

    exec sp_dropserver old_name

    GO

    exec sp_addserver new_name, 'local'

    GO

    Now when we do:

    select @@servername

    The server name is now correct but if you are on the server and try and start the database engine using "localhost" it cannot connect to the server. Error states "Cannot connect to localhost".

    Does anyone have any ideas how we can fix this? I know we could change it to the IP or the actual name instead of localhost to connect but that causes other issues for existing code. For instance, we have SSIS packages that we promote through test and production environments and in these SSIS packages we are using "localhost" and would like to still be able to do this so we don't have to change all of the existing code.

  • And if I run the SSIS Package we get the following error.

    [OLE DB Destination [676]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "localhost" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed.

  • Try using (local) or . (period) as the Server Name instead of LocalHost

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • Thanks for your response. If I try and change it to "local" even doing a Test Connection fails. We are trying to avoid putting the servername in the SSIS packages since the same packages get moved from our development environment, to system test, and finally production. Each are on a different server so that's why we were using "localhost" so that it wouldn't have to change depending on which environment it is in. This all was working just fine until we attempted the @@servername change. So I'm wondering what could still be holding on to the old servername or would've caused "localhost" to break when we attempted that change.

  • Have you restarted SQL Server since renaming using the following?

    exec sp_dropserver old_name

    GO

    exec sp_addserver new_name, 'local'

    GO

  • Yep, restarted the service and when that didn't seem to help decided to reboot the entire server for good measure. No change for the "localhost" issue.

  • Was the Windows server renamed prior to changing the SQL server name?

    Can you connect to the server remotely from SSMS?

    What network protocols are enabled for SQL server?

    Have you tried connecting using just a period as the server name as suggested above?

  • JeremyE (10/21/2010)


    Was the Windows server renamed prior to changing the SQL server name?

    Can you connect to the server remotely from SSMS?

    What network protocols are enabled for SQL server?

    Have you tried connecting using just a period as the server name as suggested above?

    1.) Yes, the server was renamed and then we renamed the SQL Server name using the above code.

    2.) Yes, we connect remotely through SSMS by putting in the server's IP.

    3.) Shared Memory, TCP/IP, and Named Pipes are enabled.

    4.) Must've overlooked the part in the first suggestion of just using a period. Tried that and it worked but then re-ran the same exact package immediately with no changes and it failed. I'm on the server running this package so it shouldn't have to go out anywhere remotely. That's why I'm wondering if there isn't something still pointing to the old server.

    Connection manager name is still "localhost", just fyi. but the servername was updated to "."

    [Connection manager "localhost"] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.

    An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Unable to complete login process due to delay in opening server connection".

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply