Old 25th September 2011, 03:47   #1
jakc
Junior Member
 
Join Date: Sep 2011
Posts: 12
Question 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.



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:



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.
jakc is offline   Reply With Quote
Old 25th September 2011, 12:51   #2
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
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.

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI

Last edited by LoRd_MuldeR; 25th September 2011 at 13:51.
LoRd_MuldeR is offline   Reply With Quote
Old 26th September 2011, 04:45   #3
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 530
Send a message via ICQ to T.Slappy
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.

Cool looking installer with custom design: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned.sk
Develop NSIS projects in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.3 Rio: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
database, sql

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump