sonda
Posts: 101
Joined: Mon Apr 30, 2018 12:01 pm

Create Database

I'm new to advanced installer and i wonder how can i achieve this : before installation to check if database exist if not to create, i added new SqlConnectionDialog:
1.png
1.png (79.94 KiB) Viewed 4885 times
: Added new predefined sql connection
2.png
2.png (43.06 KiB) Viewed 4885 times
selected option if database not exist to create also log errors to file, but when i build installer and run installation database is not created neither error is thrown also not sure where to search the log, not sure if this is all required steps to create database and also how to log errors and stop installation if error occurred while database creation (server not available, invalid logon parameters ...)
thanks in advance
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Create Database

Hello and welcome to our forums,

This could happen if you do not added any SQL scripts under the "Predef" SQL Connection you defined in "SQL Databases" view of your setup project. When no SQL Script or SQL Query is executed during installation the SQL Connection will not be established.

If no SQL Scripts are defined but you still want to use this option to create the database on the target machine, then you can add a script with a simple query. Something like:

Code: Select all

USE database_name;
Hope this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sonda
Posts: 101
Joined: Mon Apr 30, 2018 12:01 pm

Re: Create Database

Hi Daniel, i succeeded to create database, thanks
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Create Database

You are always welcome.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sonda
Posts: 101
Joined: Mon Apr 30, 2018 12:01 pm

Re: Create Database

How can i create database if database not exist if, i select SQLServerConnectionDlg?
sonda
Posts: 101
Joined: Mon Apr 30, 2018 12:01 pm

Re: Create Database

The main question is if i use SQLServerConnectionDlg, and i select Trusted connection,
2018_05_15_16_29_08_ATS_Security_configuration_manager_ATS_Security_configuration_manager.aip_E.png
2018_05_15_16_29_08_ATS_Security_configuration_manager_ATS_Security_configuration_manager.aip_E.png (27.7 KiB) Viewed 4803 times
What i will have in [Username_Prop],
2.png
2.png (31.29 KiB) Viewed 4803 times
Will database be created if i enter not existent database?
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Create Database

Hello,

When trusted connection will be checked in the SQL connection string (used by the SQL connection from "SQL Databases" page) will be inserted a trusted connection specific SQL parameter and the UID and PWD parameters will be removed form the connection string.

If you input a non existent database this will be created (with the exact name as you input) only if your SQL connection from "SQL Databases" page includes at least one SQL script which is executed.

If no SQL Scripts are defined but you still want to use this option to create the database on the target machine, then you can add a script with a simple query. Something like:

Code: Select all

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

Return to “Common Problems”