mcuser
Posts: 13
Joined: Mon Jan 17, 2011 9:30 pm

Database port test [Solved]

Hi,

I am using the TestSQLConnection (from TestODBCConnection) function to alert users if the specified DB connection info is not entered properly or invalid. The function works good enough, but since I use the JDBC driver in my application (Java app), I would like to be able to test on a static port number as well.

Any idea how I could do this?

Thank you.
Last edited by mcuser on Thu Nov 03, 2011 12:59 pm, edited 1 time in total.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Database port test

Hi,

To test a static port you can simply configure the test connection string to use a hard-coded value instead of a property. If this doesn't help, can you please give me more details?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mcuser
Posts: 13
Joined: Mon Jan 17, 2011 9:30 pm

Re: Database port test

Hi,

Thank you for your quick answer. I might not have been precise enough in my question. I am using: Custom actions > UI custom actions > Add predefined UI custom action > Test ODBC connection.

Here is the argument as seen in my AI project:

Code: Select all

Driver=[\{]SQL Server[\}];Server=[EDIT_DB_ADDR];Port=[EDIT_DB_PORT];Database=[EDIT_DB_NAME];Uid=[EDIT_DB_USERNAME];Pwd=[EDIT_DB_PASSWORD];
The action works, but entering an invalid port makes no difference (validation passes with success), even if, in fact, the DB cannot be reached on that static port.

After your answer, I tried to do:

Code: Select all

Driver=[\{]SQL Server[\}];Server=[EDIT_DB_ADDR]:[EDIT_DB_PORT];Database=[EDIT_DB_NAME];Uid=[EDIT_DB_USERNAME];Pwd=[EDIT_DB_PASSWORD];
In this case, the validation never passes with success (connection timeout with valid port).

So my question is: How can I make the built-in validation function test everything including the port?

Thank you.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Database port test

Hi,

Your original connection string should validate the port number. Can you please send us the .AIP (project) file you are using to support at advancedinstaller dot com so we can investigate it?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mcuser
Posts: 13
Joined: Mon Jan 17, 2011 9:30 pm

Re: Database port test

Here is the answer from Advanced Installer support. It fixed my problem. Much appreciated.
It seems this behavior is caused by an incorrect SqlConnectionString format. The new particularity was recently introduced by Microsoft:

Driver=[\{]SQL Server[\}];Server=[SERVER_PROP];Port=[PORT_PROP];Uid=[USERNAME_PROP];Pwd=[PASSWORD_PROP];Database=[DB_PROP];

should be:

Driver=[\{]SQL Server[\}];Server=[SERVER_PROP],[PORT_PROP];Uid=[USERNAME_PROP];Pwd=[PASSWORD_PROP];Database=[DB_PROP];

Return to “Common Problems”