Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Automatically run sql scripts


3 replies to this topic

aarvee50

aarvee50
  • Members
  • 4 posts

Posted 02 November 2004 - 06:53

Hi,
I've a couple of issues.

1. From an install shield script, I need to execute 12 different sql scripts (oracle based) automatically. I need to execute them one by one meaning, only on the completion of an item, the next one should start. How to go about? (High priority and urgent too. Pl. help!)

2. Can you trigger an external application from the install shield script?
Eg. calculator, games etc.,

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 02 November 2004 - 12:56

You can launch external applications using LaunchAppAndWait. You could run your SQL sripts in the same way (launch whatever EXE is needed to run a sql script via LaunchAppAndWait)

udayms

udayms
  • Members
  • 4 posts

Posted 05 November 2004 - 11:54

Hi Arvee,
You can write a Batch program that accepts the login info frm the installer and executes the sqls. But, for this we would need Oracle Client to be already installed in that machine.

-Uday

Arcangel_666

Arcangel_666
  • Members
  • 12 posts

Posted 05 November 2004 - 21:57


I have to run many SQL scripts in a few different ways for some of my solutions... here are some of the things I do depending on the situation.

- Running a .cmd/.bat file... usually prompt for the information and then send along that information as part of the "parameter" section of the LaunchAppandWait function.

Example:
szReplPath = szNSBSYSPath ^ "Dbase\\CREATE_STORE_SNAPSHOT.cmd";
szCommand = "B " + szAdminUser + " "+ szPwd + " "+ szServerName;

szLogMsg = "Running CREATE_STORE_SNAPSHOT.cmd";
WriteLine(nvLog, szLogMsg);
szLogMsg = "Command Line = " + szCommand;
WriteLine(nvLog, szLogMsg);

nResult = LaunchAppAndWait(szReplPath, szCommand, WAIT);

- Actually calling either "isql.exe" or "sqlplus.exe" depending on DB engine with passing it the proper location and connection information for the SQL script to use... again using the LaunchAppAndWait function

- In one instance, I write the sql file on the fly depending on user input then run one of the above Exe to actually import it.

In all instances, the LaunchAppAndWait function will wait either for the whole batch file to complete before continuing to the next one or will wait for the actuall Sql.exe to finish doing it's thing before continuing on to the next one.

Hope this helps

Nick