PDA

View Full Version : SQL Scripts functionality



bhagelin
08-16-2005, 11:24 AM
Hello everyone,

I'm evaluating InstallShield 11, and am wondering how exactly the SQL scripts view interacts with SQL server at runtime. With past versions of InstallShield, we've written Installscript that runs a command line OSQL procedure to execute SQL scripts.

Are scripts created in the SQL scripts view run with OSQL, Query Analyzer, or something else?

Thank you for any assistance.

hidenori
08-16-2005, 04:22 PM
InstallShield uses the sqloledb driver to connect to a SQL Server. The run-time that has the SQL support requires MDAC 2.5 installed on your target system.

bhagelin
08-16-2005, 04:36 PM
Thanks for your reply. So the sqloledb driver is used to connect to the server, and then MDAC 2.5 is used to execute sql commands on that server?

Or do you mean that MDAC 2.5 is required to even have a connection?

I've looked at the Installscript code and found that the function that actually executes a SQL script that is associated with a particular component is the SQLRTComponentInstall( szComponent ) function. Unfortunately the help menu doesn't have a description of this function.

Do you know where I can find more detailed techincal specifications of how this function is interacting with SQL server (or other functions that interact with SQL server)? Does this function simply interact with MDAC to execute SQL statements?

Thanks..

hidenori
08-16-2005, 05:01 PM
Actually, MDAC installs the sqloledb driver. You need to have MDAC 2.5 or higher installed on the target system in order to connect & run SQL scripts using InstallShield built-in SQL support.

The SQLRTComponentInstall( szComponent ) function is designed to execute SQL scripts specified in the SQL Scripts view during installation. The SQLRTComponentUninstall( szComponent ) function does the same during uninstallation.

The OnSQLServerInitialize() event will prompt the SQLLogin dialog for each connection specified in the SQL Scripts view. When you click the Next button, it will open the connections so that SQLRTComponentInstall() and SQLRTComponentUninstall() will be able to execute SQL scripts under the connections.

Regards.

bhagelin
08-16-2005, 05:15 PM
Yes, do you know how SQLRTComponentInstall() and SQLRTComponentUnInstall() interact with the SQL server and execute scripts? Do you know of any technical documentation where I can learn more?

I need to determine what the differences will be between using those functions and running a straight OSQL script are.

hidenori
08-16-2005, 05:31 PM
Unfortunately, we don't have detailed documentation for SQLRTComponentInstall( szComponent ) and SQLRTComponentUnInstall( szComponent ) at this time. Those functions will open the script file associated with szComponent which is specified in the SQL Scripts view. Then it will parse the script line by line until reach to the end of the file, and it will send SQL statements as a batch to a SQL Server when it encountered a GO statement.

Let me know if you need more information.

bhagelin
08-17-2005, 03:40 PM
Thank you for your response, hidenori. I may ask more questions as I get into more detail with the sqloledb driver.

bhagelin
08-17-2005, 05:13 PM
I have another question on this topic; Does SQLRTComponentInstall use ADO (which in turn uses the OLE DB driver) to access data in the database? Or does SQLRTComponentInstall interact directly with the sqloledb driver?

hidenori
08-17-2005, 05:18 PM
It uses ADO to access data in the database.

bhagelin
08-17-2005, 06:04 PM
And to establish the connection as well correct?

hidenori
08-17-2005, 06:07 PM
Yes. We use it to establish a connection and run SQL scripts.

bhagelin
08-17-2005, 06:13 PM
Thanks again for your help on this topic. :)