PDA

View Full Version : MSDE/SQL Svr Mixed Mode Authenticate



willemse
06-08-2004, 01:07 PM
I am trying to set Mixed Mode Authentication for MSDE/SQL Server, but I keep getting an exception when I write to the property. Reading works fine, however. The same strategy works in VB, C#, etc. I do not understand why Installshield throws an exception. Can someone help?

function myFunction(szMACHINE,szUSER,szPASSW)
OBJECT SQLSERVER,security;
string szErr;
begin
try
set SQLSERVER=CreateObject("SQLDMO.SQLServer");
SQLSERVER.LoginTimeout=30;
SQLSERVER.Connect(szMACHINE,szUSER,szPASSW);
set security = SQLSERVER.IntegratedSecurity;
//set security.SecurityMode=2;
security.SetSecurityMode(2); //2=Mixed Mode
catch
szErr=Err.Description;
endcatch;

The code fails in runtime at the SecurityMode property:
I tried: set security.SecurityMode=2; //like it is done in VB
szErr is then set to "Member not Found"
Then I tried:
security.SetSecurityMode(2); //Like the C++ prototype
szErr is then set to "Unknown name"

Reading the property works fine:
strlen = SQLSERVER.IntegratedSecurity.SecurityMode; //2=Mixed Mode
SprintfBox (INFORMATION, "System Information",
"Result: %ld.", strlen);

Can anyone explain why it doesnt work, and perhaps give the correct syntax for writing the SecurityMode property?

getnandu
06-09-2004, 07:24 AM
Hi willemse,

I has the same trouble w/ MSDE 2000. What i found was either you have to change the Authentication method during installation using the 'SECURITYMODE = SQL' in the command line OR
change a registry key.

http://support.microsoft.com/default.aspx?scid=kb; LN];285097

Look at the above KB link , hope this helps . (KB ID is 285097)

Nandu

willemse
06-09-2004, 07:33 AM
Yes, I probably will be better off writing to the registry. My colleagues advised me that an install based on SQLDMO is not as stable as one may wish.

I solved the issue around my question at about the time you posted: the InstallScript executes without throwing an exception if you do not use the 'set' keyword, like so:

mode = 2; //for mixed-mode
SQLSERVER.IntegratedSecurity.SecurityMode=mode;

Thanks for the KB link.