cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dbartnick
Level 3

SQL connection validation

I am trying to validate the connection to an existing SQL Server. The thing that seems to be the big issue is that I only want it to populate the results in a property instead of displaying an error message. I am using Basic MSI. I've tried using ISSQLServerValidate, but it always displays an error. Does anyone know of a way to just test the connection without the message?

Thanks,
Dave
Labels (1)
0 Kudos
(5) Replies
schmoli
Level 6

you can do it in an Installscript CA if you don't mind making an ADODB connection.. here's a snippet from one of my custom actions:

set Connection = CreateObject("ADODB.Connection");
set Command = CreateObject("ADODB.Command");

Connection.Provider = "SQLOLEDB.1";
Connection.Properties("Data Source").Value = DataSource;
Connection.Properties("Initial Catalog").Value = "";
if (AuthenticationType = "0") then
Connection.Properties("integrated security").Value = "SSPI";
else
Connection.Properties("user id").Value = UserName;
Connection.Properties("password").Value = Password;
endif;

// Open Connection
UTIL_WriteToLogFileUI(hMSI, "Creating database connection. If this fails you most likely have an authentication issue.", userInterface);

Connection.Open;
0 Kudos
hidenori
Level 17

Try setting 1 to the IS_SQLSERVER_CA_SILENT Windows Installer property in order to suppress the connection error dialog. An connection error description is set to the IS_SQLSERVER_STATUS_ERROR property.

Hope that helps.
0 Kudos
schmoli
Level 6

hidenori wrote:
Try setting 1 to the IS_SQLSERVER_CA_SILENT Windows Installer property in order to suppress the connection error dialog. An connection error description is set to the IS_SQLSERVER_STATUS_ERROR property.

Hope that helps.


oh that's pretty sweet. I end up doing much more than just testing the connection (I am having to verify that specific databases of specific versions exist.) Good to know about that property though.
0 Kudos
dbartnick
Level 3

SWEEEET! Thank you very much!

What is the flag to enable the dialog message? I tried 0, but no luck.
0 Kudos
hidenori
Level 17

Try setting an empty string.
0 Kudos