Bug #52996 DSN connection parameters override those specified in the connection string
Submitted: 20 Apr 2010 17:27 Modified: 6 Aug 2013 20:37
Reporter: Lawrenty Novitsky Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.1.6 OS:Any
Assigned to: Lawrenty Novitsky CPU Architecture:Any
Tags: SQLDriverConnect parameters DSN

[20 Apr 2010 17:27] Lawrenty Novitsky
Description:
DSN parameters take precedence over parameters specified in the connectin string passed to SQLDriverConnect.
Particular case of that - it's impossible to reset from the connection string any option specified in the DSN.
 
From the http://msdn.microsoft.com/en-us/library/ms715433(v=VS.85).aspx
"The driver uses any information it retrieves from the system information to augment the information passed to it in the connection string. If the information in the system information duplicates information in the connection string, the driver uses the information in the connection string."

There is also another bug bound with described above. Options that are set(or rather not set) through the OPTIONS bit flags supersede options set individually by their names(in a connection string).

How to repeat:
I think one of the easiest ways to repeat the problem would be to change one of tests from the myodbc tests suite that establishes alternate connection(e.g. t_cache_bug from my_result).
Change some of parameters like SERVER, UID or PWD to contain a wrong data and run the test. Given that DSN contains all required connection info, test will pass still pass.

To repeat 2nd bug, add NAMED_PIPE=1; and observe that test doesn't try to connect via named pipe and still passes. windows here is required obviously. and local server shouldn't accept connection via named pipe, or specify some wrong SOCKET as well.

Suggested fix:
Driver should first load parameters from the DSN, then process OPTIONS parameter, then parse the rest of the connection string.
[20 Apr 2010 18:29] Jim Winstead
I agree with your assessment.
[18 Apr 2013 10:00] Bogdan Degtyariov
Fixed in 5.1.13 and 5.2.6
[6 Aug 2013 20:37] Daniel So
Added the following entry to the Connector/ODBC 5.2.6 and 5.1.13 changelog:

The configured values of a DSN's parameters overrode the values provided through the connection string, instead of the other way round.