iranlondon
Posts: 21
Joined: Wed Mar 13, 2019 3:13 pm

Re: attach sql db file show me error

Hi
Thanks for Reply.
your solution worked but it make an aditional database that we set it's name in predefinedconnectiondlg.
that sounds not good. is there a way to attach the db without create additional db. i Think i because of this option you noticed:
go to "SQL Databases" page --> "DlgPredefinedConnection" --> in the "Database" field, change the database name from "TestDb" to another name (this is required because your script already creates a database with that name)

check the "Create database if it does not exist" option
please give me a solution that attach db without create additional db.
thanks
iranlondon
Posts: 21
Joined: Wed Mar 13, 2019 3:13 pm

Re: attach sql db file show me error

Hi
Thanks for Reply.
your solution worked but it make an aditional database that we set it's name in predefinedconnectiondlg.
that sounds not good. is there a way to attach the db without create additional db. i Think i because of this option you noticed:

go to "SQL Databases" page --> "DlgPredefinedConnection" --> in the "Database" field, change the database name from "TestDb" to another name (this is required because your script already creates a database with that name)

check the "Create database if it does not exist" option

please give me a solution that attach db without create additional db.
thanks
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: attach sql db file show me error

Hello,

A solution would be to let the user select an already existing database and attach your database to it.

However, this might be troublesome if the user does not have any database created.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
iranlondon
Posts: 21
Joined: Wed Mar 13, 2019 3:13 pm

Re: attach sql db file show me error

Hi
A solution would be to let the user select an already existing database and attach your database to it.
I think it is clear that Attach a database to an existing database do not work and tell the database exist!
because when a database created before attaching the database has no meaning.
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: attach sql db file show me error

Hello,

I have done some further investigations about this and I think I found a workaround that will help you avoid creating a database at install time.

Please go to "SQL Databases" page --> your predefined connection --> in "Database" field, please insert a property that resolves to an empty value during installation (that basically does not currently exists), e.g.:

Code: Select all

[MY_EMPTY_PROPERTY]
This way, your database will be attached without needing to create an additional database.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
iranlondon
Posts: 21
Joined: Wed Mar 13, 2019 3:13 pm

Re: attach sql db file show me error

Hi
Please go to "SQL Databases" page --> your predefined connection --> in "Database" field, please insert a property that resolves to an empty value during installation (that basically does not currently exists)
i create a property with name of "[EMPTY_DATABASE]" as aip file attached but give me the error "There was an error during SQL script execution process".
I attached the log file too.

i have another question and that is when i used the solution that create additional db, if I use trusted connection in installer it give me the error of "{SQL_STATE: 42000} [Microsoft][ODBC SQL Server Driver][SQL Server]CREATE DATABASE permission denied in database 'master'."
Attachments
Sample Setup.aip
aip file with empty property
(39.21 KiB) Downloaded 825 times
MSID92F.LOG
log file with empty property
(319.87 KiB) Downloaded 585 times
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: attach sql db file show me error

Hello,

Could you please try to uncheck the "Create database if it does not exist" option and let me know if that helps?

In what regards your second quesiton, if you use a trusted connection, the connection will try to connect to the "master"database (which comes by default when you install SQL Server) and to which most probably you do not have permissions.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
iranlondon
Posts: 21
Joined: Wed Mar 13, 2019 3:13 pm

Re: attach sql db file show me error

Hi
by uncheck "create database if not exist" it worked.
Thanks a lot.
but as in my previous post i asked about connect with trusted connection you said:
In what regards your second question, if you use a trusted connection, the connection will try to connect to the "master"database (which comes by default when you install SQL Server) and to which most probably you do not have permissions.
is there a solution to attach database by trusted connection?
Thanks in advanced
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: attach sql db file show me error

Hello,

In order to enable "Trusted Authentication", please proceed as it follows:

- go to "SQL Databases" page

- select "DlgPredefinedConnection"

- under "Authentication" section, please check the "Trusted Authentication (Windows Integrated authentication)" checkbox.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
iranlondon
Posts: 21
Joined: Wed Mar 13, 2019 3:13 pm

Re: attach sql db file show me error

Hi,
Thanks for reply.
In order to enable "Trusted Authentication", please proceed as it follows:

- go to "SQL Databases" page

- select "DlgPredefinedConnection"

- under "Authentication" section, please check the "Trusted Authentication (Windows Integrated authentication)" checkbox.
with this option just trusted connection will be use.
I wanna create database both with trusted connection and sql connection during setup.


thank you.
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: attach sql db file show me error

Hello,

In this case, I think you can uncheck the option.

The predefined "SqlServerConnectionDlg" has a checkbox that lets the user decide whether he want to use or not the "Trusted Authentication".

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
iranlondon
Posts: 21
Joined: Wed Mar 13, 2019 3:13 pm

Re: attach sql db file show me error

Thanks. that worked like charm!
I really thank a lot you because you give your time to me to solve my problem.
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: attach sql db file show me error

You are always welcome!

It's always my pleasure to help. :)

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

Return to “Common Problems”