PDA

View Full Version : Checking for existence of database and login



emtang
05-14-2004, 01:20 PM
I recently upgraded from InstallShield 6.1 to InstallShield X, and am in the process of converting my scripts. One thing I noticed with X is it has a SQL feature. I'd like to take advantage of that and believe I've gotten most of it down, but need help with checking whether a database and a login exists. I am using Microsoft SQL Server by the way.

In 6.1, I had a prototype running a SELECT statement on the sysdatabases table in the master database to determine whether the database specified by the user exists. This is done through ADO. I then ran another SELECT statement on the sysxlogins table to determine whether the specified login exists. If either of those conditions is true, I flag a warning to the user.

I'm wondering how I can accomplish this with InstallShield X.

djemberay
05-15-2004, 05:24 PM
I have some questions as well, the SQL login dialog has an action called ISSQLSERVERVALIDATE, unfortunately this action is not documented anywhere that I can find. If I'm missing something, I apologize in advance, but at this juncture, I'm pretty disappointed with IS X documentation. I see all these constants and actions and keywords that are not documented, but part of the product so I have to guess or run blind. I don't even know exactly what this action does or returns! I've done a search on the IS website as well as the documentation and the web in general. Nothing. Please document the product or it doesn't help us!

kind regards,

-raymond

emtang
05-18-2004, 12:19 PM
Okay so I've thought about this some more and will continue using my existing prototypes for checking whether a database or login exists. Question now is: how do I, or can I, reference the login and password provided by the user in the OnSQLServerInitialize dialog?

RobCoon
05-18-2004, 01:02 PM
emtang,

The OnSQLServerInitialize event can be overridden in your script. In that event, the username and password are accessible as variables, and you could copy them to global variables if you think you will need to use them elsewhere in the script.

djemberay,

What type of project are you using? I couldn't find any references to ISSQLServerValidate in InstallScript projects. It is unfortunately possible that some constants and/or prototypes were released that are not actually in use yet, reserved for future use.

Is there something specific that you are trying to accomplish?

djemberay
05-19-2004, 11:06 AM
Rob,

I apologize if I sounded a bit scathing. A little frustration coming through I guess. I've got an install where I actually already know the name of the SQL Server, but still want to validate from an authentication POV. I've taken a new Web Project (this is an IIS application) and added a SQL connection under the SQL Servers section in the Installation Designer. This creates two SQL dialogs in the dialogs list. I removed the browse dialog becuase I already know the name of the SQL server and modified the SQL Login dialog from a drop down combo box to a text box with the name filled in. This allows the user to simply choose their authentication method and credentials (if applicable).

I'm having trouble with the install stopping on this dialog. I even tried creating a new install without modifiying the SQL dialogs and I still can't get the install to move past the login dialog. In an effort to debug, I examined the dialog "guts" and found the ISSQLSERVERVALIDATE function I was mentioning previously. I'm just trying to understand why things aren't working as I expect and was looking for some documentation on the subject. I hate to have to write my own validation when I was expecting to be able to use the one that comes with InstallShield.

Any help you can offer will be much appreciated.

best,

-raymond

hidenori
05-19-2004, 01:29 PM
Raymond,

Do you receive any error messages when you click the Next button on the SQLLogin dialog? If so, what does it say?

Hidenori Yamanishi
InstallShield Software Corporation

djemberay
05-19-2004, 01:33 PM
Hidenori,

Thank you for replying. No, I do not receive any error messages. Assuming I have everything correct, it should go to the "Ready To Install" dialog. I hit the next button, there is some activity, but nothing happens.

I'm running this on the latest version of IS X on a Windows XP machine (Professional). I've also tried going through the MSI debugger but it just stops and I don't get any errors there either.

Thank you!

-raymond

djemberay
05-19-2004, 01:43 PM
Hidenori,

I'd really like to figure this out and help you to help me figure it out. I'll do whatever it takes. Let me know what I can try or what information I can provide.

kind regards,

-raymond

hidenori
05-19-2004, 01:44 PM
Raymond,

Would it be possible for you to email me your .ism projects at hidenoriy@installshield.com? So I will take a look at what is going on.

Thank you,
Hidenori

hidenori
05-19-2004, 02:20 PM
Raymond,

Thank you for sending your projects. The problem here is that you don't have any SQL scripts associated with your connection. InstallShield X build engine doesn't build connections that have no scripts into an MSI package and the ISSQLSERVERVALIDATE custom action doesn't set a correct return value when there are no SQL connections to validate in the installation. That is because the installation stops at the SQLLogin dialog. I submitted the work order #1-O458P to address this issue in a future release. For now, I assume you will have at least one script under your connection. It shouldn't be an issue.

Regards,
Hidenori