开发者

How to ping a database from NSIS?

开发者 https://www.devze.com 2023-04-07 01:36 出处:网络
Putting together a NSIS installer. (first time) Currently, a manual step in our install is to make a URL connection to a database, and save a basic connection properties file to a folder under Tomcat

Putting together a NSIS installer. (first time)

Currently, a manual step in our install is to make a URL connection to a database, and save a basic connection properties file to a folder under Tomcat.

To aid this, we currently use a small JAR application that helps the user build this connection property file.

It has built in functionality to try and ping the DB. It aids users by having a drop down to choose different db vendors/versions, and thus helping with building the URL.

How to ping a database from NSIS?

In my mockup, ideally, I wanted something that did away with the JAR app and have this component built 开发者_StackOverflow社区into the installer. Something like this:

How to ping a database from NSIS?

I already know that I will need to create a custom page for this, (will use something like NSISDialogDesigner to assist with this).

The bit that I am unsure about, is the best approach for pinging the database from NSIS to ensure a correct URL/credentials has been supplied, and to return the errors back to the custom page.

What would be the best approach for implementing this functionality within a NSIS installer?

For background, once I have achieved this, a later step will be to create a database by running some SQL scripts I have. Just thinking ahead, I guess which database vendor/version they have, will depend on which sql script to run. Im thinking that if the user chooses e.g. SQL Server 2005 on this page, this could be writen to a variable to use later when choosing the right sql script.


The best way of pulling this off is to write a helper commandline application which you should run invisibly in the background and then check the exit code for success or failure. This helper app can be Java, C++, C#, or anything, whatever you're comfortable with. I've worked on several very large NSIS deployments and we had maybe 10 - 20 such tools launched during different phases of setup. For single WIN32 API calls, NSIS provides a P/Invoke-like wrapper, but for anything even remotely complicated, helper apps are the way to go.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号