nchounlapane
Posts: 17
Joined: Tue Mar 31, 2020 10:01 pm

Post-Install pre-requisite unable to run SQL inline script

Fri Jun 18, 2021 8:37 pm

Advanced Installer 16.7
Enterprise

I have a post-install prerequisite that has a custom SQL connection that runs several inline SQL scripts. Running the main install followed by the post-install prerequsite runs normally as expected but when running via basic install, the post-install prereq cannot connect to the SQL database. Within the logs, I get the following error:
CREATE DATABASE permission denied in database 'master'
Process of the install:
1. Execute Main install with the following command:

Code: Select all

.\program.exe /qb /passive 
2. After main install finishes, it passes [SERVER_PROP] into the post-install prereq's Install Command Line (Basic UI)
3. Post-install prereq starts
4. First custom action sets [SQL_AUTHORIZATION] to the following:

Code: Select all

Uid=localuser;Trusted_Connection=yes;
5. Second custom action sets [SqlConnectionString] to the following:

Code: Select all

Driver=[\{]SQL Server[\}];Server=[SERVER_PROP];[SQL_AUTHORIZATION]
6. Post-install prereq should execute SQL scripts as expected

Troubleshooting:
-Ensured that the Local sys admin account has sufficient privileges to create databases in SQL
-Ensured that installs work on Full UI installation
-Attempted on Advanced Installer 18.3

*One other thing I came across is when calling [LogonUser] resulted in SYSTEM instead of the current user so I had to explicitly set Uid=localusername.

I have sent a sample project to the support email with subject line as the same name of this post.

Catalin
Posts: 4358
Joined: Wed Jun 13, 2018 7:49 am

Re: Post-Install pre-requisite unable to run SQL inline script

Mon Jun 28, 2021 5:22 pm

Hello Nicholas,

Could you please try to check the "Impersonate User" option and let me know if that helps?

You can find the option in your prerequisite project --> "Sql Databases" page --> "Impersonate User" (on the ribbon).
ImpersonateUser.png
ImpersonateUser.png (114.63 KiB) Viewed 6391 times

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

nchounlapane
Posts: 17
Joined: Tue Mar 31, 2020 10:01 pm

Re: Post-Install pre-requisite unable to run SQL inline script

Tue Jul 27, 2021 6:47 pm

I apologize for the super late response. Our main installer does have Impersonate User, but it looks like the sample project I've sent you guys doesn't have that enabled. We figured out that there were some missing parameters that were not set and eventually figured out what was going on. Thank you for the response.

Nick

Catalin
Posts: 4358
Joined: Wed Jun 13, 2018 7:49 am

Re: Post-Install pre-requisite unable to run SQL inline script

Wed Jul 28, 2021 12:42 pm

You are always welcome, Nick!

I am glad you guys were able to find the culprit!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”