Archive: Creating a DB connection file via NSIS?


Creating a DB connection file via NSIS?
I am putting together an installer with NSIS (1st time, but liking it and have learnt a lot from these forums and from the NSIS tag on Stack Overflow).
This installer has already installed a JRE and Tomcat.

The next part will be to create a connection file to allow my application to point to a database.
- Save this file into $PLUGINSDIR (will move it once I deploy some WARs at a later step).

Currently, when manually doing our installs, we have a small JAR application that helps the user build this connection property file.
It has built in functionality to try and ping the DB, regardless of its Oracle, Oracle XE, SQL Server 2005/2008
It has a drop-down which provides the bones of the URL connection strings, and then user can tweak if need be.

http://www.dekho.com.au/help/32/Imag...image13_19.jpg

In my original mockup of an installer, ideally, I wanted something that did away with the JAR app and had this component built into the installer. Something like this:

https://cacoo.com/diagrams/76bVHnXFP...=1316069089558

Little unsure on where to start.
Had a look at some database related posts, and saw some samples here.

I would like some advice/initial pointers on the best way to go about this.
- Should I be trying to code this all within NSIS, or should I be calling on something external to test the connection? Not sure if you can Telnet via NSIS?
- Has anyone seen any similar samples that I can reverse engineer?
- Any other advice would be great.


Thanks in advance.

For info, 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.


Can't you call the JAR in the background (without GUI) and pass the parameters that the user has entered in the NSIS GUI (url, schema, username, password) to the JAR as command-line arguments? Then return the result of the test from the JAR via Exit Code?

That will probably be the easiest solution, if you already have coded that JAR and also your installer installs a JRE anyway.


Use NSIS as interface to your Java application:
- enter all parameters into NSIS form [custom nsDialogs page] and pass them to application
- app returns some result and NSIS shows appropriate MessageBox [if necessary]
- continue on next page with next app...

This is great approach in case you need to modify/add some feature because you can simply change application and installer does not need to be rewritten.