November 17, 2011 at 5:21 am
For SQL Server 2005
Windows Version: 2003 SP2 32bit
application in C++
Problem:
CoCreateInstance for sqloledb.dll failed with “Class not registered” error
If I try to make connection to SQL server using impersonated user.
If I use local system account or windows auth then it works fine but if I impersonate
A user who is making connection to sql server then only its fail .
What may be the reason for this ? This is c++ program.
extern const GUID CLSID_SQLOLEDB = {0xc7ff16cL,0x38e3,0x11d0,{0x97,0xab,0x0,0xc0,0x4f,0xc2,0xad,0x98}};
hr=CoCreateInstance(CLSID_SQLOLEDB,NULL,CLSCTX_INPROC_SERVER,
IID_IDBInitialize,(void**)&pIDBInitialize);
}
if(FAILED(hr))
{
if (hr==REGDB_E_CLASSNOTREG)
{
FATAL1(dllmissing,"oledbx.dll");
}
}
Notes:
1.In registry exclusive access is given to this class id and this key for sqloledb.dll and this is successfully registered by that user
2.User who is making connection is part of administrator group on windows
3.if windows server login user and user who is making connection to SQL server are same
then its work fine but if both are different , though both are part of administrator group , then its fail
4.From SQL server management studio , this user can make connection without any error
Can you please help me what kind of security setting are needed in order to allow
this impersonated user to make connection to SQL server ?
November 17, 2011 at 7:10 am
I don't think it's a SQL Server issue at all.
It says a different thing: "Class not registered". I guess it's a registry / windows policies permissions issue.
I would trace the process with Sysinternals Process Monitor (you can Google that) and activate Windows Event logging for policy Success/Failure.
I'm pretty sure you will find a clue that way.
Hope this helps,
Gianluca
-- Gianluca Sartori
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply