codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

ODBC Connections in Advanced Installer

Hi,

Consider the following scenario.

I add a new ODBC driver (let’s say Oracle) to be installed using Advanced Installer:
ODBC.PNG
ODBC.PNG (5.8 KiB) Viewed 5854 times
I want to allow the user to enter the Oracle database connection info in the dialog phase, so I can save the information, verify the connection is good, and, possibly, run a query against the database (during the UI phase). I see there is a “SQLConnectionDlg” and a “SQLServerConnectionDlg”. The latter looks like it’s only meant for Microsoft SQL, so I would use the former for Oracle (or any non-SQL Server connection).

The problem seems to be that any ODBC drivers installed using AI aren’t available for use until after they are installed in the execution phase(?). Is there any way to test an ODBC-based database connection (using an ODBC driver that’s not already installed on the machine, like Oracle) during the UI phase?

I see there is a “Test Sql Connection” button on the “SQLServerConnectionDlg”, but I’m guessing it’s using the SQL driver that Microsoft includes (by default) in Windows. But, what if I want to test the connection of a database that doesn’t have a driver already installed on the machine (basically, any non-Microsoft database)? I know I could add the ODBC driver packages/redistributables as pre-requisites. But, since you can’t conditionalize pre-requisites, that’s not a great option.


Thanks!
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: ODBC Connections in Advanced Installer

Hi,

I can confirm you that your assumptions are right. Our Test ODBC connection custom action can use only the ODBC drivers available on the system during the UI stage of installation. And the workaround solution for your case will be indeed to install the ODBC driver within a pre-install prerequisite package.

But if you want the ODBC driver installation be optional, then the only workaround solution I can think of will be to add its resources as temporary files in "Files and Folders" page and then create your own custom action that will launch and install the ODBC driver resources. This custom action can be called from one of your installation dialogs.

Hope this helped somehow.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

Re: ODBC Connections in Advanced Installer

Thank you for the confirmation Daniel. It would be a nice enhancement to AI if this could be made possible. Though, I'm not sure how technically feasible it is. I know best practices suggest not making permanent system changes during the UI phase (a rule that I've broken many times). But, if it was some how possible to invoke the ODBC driver without "installing" it. Like, maybe referencing the ODBC driver dll(s) directly or using some API call. Just thinking out loud.

Again, thanks for the help!
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: ODBC Connections in Advanced Installer

Hello,

You are always welcome!

Indeed, as you have mentioned, this would not be technically feasible due to the fact that it is not considered a good practice to make machine changes during the UI stage.
But, if it was some how possible to invoke the ODBC driver without "installing" it.
To be fully honest with you, I am not quite sure this is possible. However, if it is, then perhaps you can create a custom action that invokes the driver without installing it.

I've tried to do some research in this matter, but unfortunately I did not find anything that might be useful here.

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

Return to “Building Installers”