We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

Create Database if it does not exist

Hello,

I am working on an installer, where I want to

Detect if SQL Server Express is installed - ( I have this working )
Check if the user has connection rights - ( see screen shot PredefinedCondition.png )
Create a database if it does not exist - ( fails -- see screen shot TestDialog_Before.png and TestDialog_After.png )

Any suggestions?

Thanks
Mike
Attachments
TestDialog_After.png
TestDialog_After.png
TestDialog_After.PNG (53.24 KiB) Viewed 14742 times
TestDialog_Before.png
TestDialog_Before.png
TestDialog_Before.PNG (29.68 KiB) Viewed 14742 times
PredefinedCondition.png
PredefinedCondition.png
PredefinedCondition.PNG (36.5 KiB) Viewed 14742 times
MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

Re: Create Database if it does not exist

Here is a snapshot of my management console
Attachments
SQLExpressDB.PNG
SQLExpressDB.PNG (44.69 KiB) Viewed 14741 times
MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

Re: Create Database if it does not exist

What is interesting to note... is that if I create the database in my management console
( see createdDB.png )

The test from AdvancedInstaller works ( see TestWorksAfterManuallyCreatingInSQLServer.png )
Attachments
TestWorksAfterManuallyCreatingInSQLServer.png
TestWorksAfterManuallyCreatingInSQLServer.png
TestWorksAfterManuallyCreatingInSQLServer.PNG (32.56 KiB) Viewed 14741 times
createdDB.png
createdDB.png
createdDB.PNG (43.06 KiB) Viewed 14741 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Create Database if it does not exist

Hello Mike,

I think this may happen if you also uses the "Database" ODBC parameter when testing the ODBC connection. If you added the "Database" parameter into the "SqlConnectionString" property, when using the "Set installer property value" event on your test SQL connection dialog, then please remove this parameter from the "SqlConnectionString" property and test again.

Let us know if this helped, otherwise please please send us the .aip (project file) to support at advancedinstaller dot com so we can investigate their settings.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

Re: Create Database if it does not exist

Daniel,

Here is my aip file... please see if you can help me out.

(I removed the SQLExpress from the zip file... it was 170mb )
Attachments
Setup.zip
(8.21 KiB) Downloaded 639 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Create Database if it does not exist

Hello Mike,

Please note that when you don't have any SQL Scripts or SQL Queries added under your SQL Connection you added in "SQL Databases" page, in this case the SQL Connection will not be established during installation; it will be skipped. Therefore the "Create database if it does not exist" option won't apply unless at least one SQL Script or SQL Query is executed during installation.

So, to achieve what you need please add at least a script under your Sql Connection. For instance you can add a script with a simple query. Something like:

Code: Select all

USE database_name;
Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

Re: Create Database if it does not exist

Daniel,

I found somebody else's page that had something similar to what I was trying to do and followed their steps, which included using scripts like you suggest.

It still does not work

I have attached my aip file again. ( I have deleted the prerequisites folder again )

Please help me fix this..

Thanks
Mike
Attachments
Bin.zip
AIP for TestDBInstaller
(7.4 KiB) Downloaded 511 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Create Database if it does not exist

Hello Mike,

Can you tell us what exactly doesn't work? Which database is not created? Do you get any error during the installation?

Please also send us a verbose log of the installation so we can investigate it too.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

Re: Create Database if it does not exist

Daniel,

This is getting very frustrating... :(

I have sent you my entire aip file. Did you open it? Did you build it? Did you run it? Does it work for you?

I assume that the information you requested is within the aip project and I also assume (sine your company wrote the software) you can debug the installation process on your end and get all the log files you need. ( I assume that was the purpose of sending you the aip file? )

Please provide more "support" than firing questions back to me, when I have provided you the aip project that exhibits the problem.

Thanks
Mike
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Create Database if it does not exist

Hello Mike,

I apologize for not giving you enough information. I had already tested your installation behavior on our side and the "TestInstallerDB" database and the "Computers" table are successfully created during installation. Here is attached a screenshot.
screenshot.jpg
screenshot.jpg (107.63 KiB) Viewed 14694 times
Now, to try checking what goes wrong on your side I will further need a verbose log of the failing installation from your side. Also, please give us more details about the issue you are facing with. Can you confirm that it is the "TestInstallerDB" database which is not installed by your setup?

Thank you for your understanding.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

Re: Create Database if it does not exist

Daniel,

Communication is key is just about every facet of life...

Thank you for confirming your results.

I have had issues with the machine I was using to test the install and just reformatted it.

I will try again with my installer today and let you know the results.

Thanks
Mike
MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

Re: Create Database if it does not exist

Daniel,

I just tried the TestDBInstaller on my 100% new and CLEAN system

See attached image

How do I setup the installer to generate logs? ( please be very specific as I do not know your product well enough for abstract instructions )

Mike
Attachments
FailedInstall.png
FailedInstall.png (110.26 KiB) Viewed 14686 times
MLiss@Cetrus.com
Posts: 366
Joined: Wed Dec 30, 2015 5:40 pm

Re: Create Database if it does not exist

Daniel,

something was amiss on my machine... after I reformatted it ... the install worked.

go figure.

Thank you for your help.

Mike
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Create Database if it does not exist

You're always welcome Mike.

I'm glad you got this working.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”