November 17, 2005 at 7:28 am
I am reposting this here from another forum. I originally posting this in the General Forum under a different category.
Please note I am Logged into the local machine using the Admin account.
SQL is set up using mixed mode authentication.
If the service is running as it should be this always works:
try
{
_SQLServer2Ptr spSQLServer(__uuidof(SQLServer2) );
cout << "SQL Server Instance Created" << endl;
spSQLServer->LoginTimeout = 20;
cout << "Login Timeout Set" << endl;
_bstr_t s("(local)\\MYINSTANCE");
_bstr_t u("SA");
_bstr_t p("myPassword");
cout << "Attempting to Connect" << endl;
spSQLServer->Connect(s,u,p);
}
Now I am trying to test/Start SQL Service
This ALWAYS Fails with an RPC Error...basically saying it cannot find the server
The line that throws is the if(...) If I leave the if(...) out the Start(...) throws with the same error.
spSQLServer->Name = "(local)\\MYINSTANCE";
if((HRESULT)spSQLServer->Status == SQLDMOSvc_Stopped)
spSQLServer->Start(false);
This ALWAYS works
spSQLServer->Name = "127.0.0.1\\MYINSTANCE";
if((HRESULT)spSQLServer->Status == SQLDMOSvc_Stopped)
spSQLServer->Start(false);
This also ALWAYS fails.
spSQLServer->Name = "localhost\\MYINSTANCE";
if((HRESULT)spSQLServer->Status == SQLDMOSvc_Stopped)
spSQLServer->Start(false);
I can start the service reliably with the loopback address. However, before I release I would really like to know what is going on. If the Connect(...) acted the same way I would understand.
I would really appreciate anyone that can shed some light on this.
Thanks in advance,
Bob
November 17, 2005 at 7:49 am
I'm really out of my area, but 127.0.0.1 is assigned by default to the network interface and allows local addressing. (local) is a SQL Server only connection item from their tools. I'm not sure if it is supported by Windows (non-SQL Server) tools/APIs.
Localhost should be mapped in your local hosts file, so i'd expect that to work, but it's possible a machine would not have that setup.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply