Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify a default driver for ODBC

Tags:

vb6

odbc

adodb

dsn

I have a legacy VB6 app which builds a DSN based on a parameter in a config file. The parameter is an ODBC connection, and the connection has a name (DSN-NAME) which maps a server (DBSERVER) to a driver ("SQL Server Native Client").

Generally, it builds a DSN like this:

DSN=DSN-NAME;User=foo;Password=bar

If I specify a hostname in the file, it builds a connection string which says

DSN=DBSERVER;User=foo;Password=bar

The error message reported is:

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

This suggests to me that there is perhaps a way of specifying a default driver, which may mean I can specify just the server name in the config file, and not need to create the ODBC connection.

(I am aware these can be created automatically; this is just to simply installation, and to satisfy my curiosity).

How do you specify a default driver? If I can set the default driver to SQL Server Native Client, can I then say DSN=DBSERVER and connect?

Edit: the point was to try and do this without changing the connection string. All the research suggested this isn't actually possible, but he wording of the dialog suggested it might be.

like image 350
crb Avatar asked May 11 '09 20:05

crb


People also ask

How do I change ODBC 32-bit Drivers to 64-bit?

With 64-bit versions of Windows, the previous 32-bit ODBC Driver Manager is now located in a different location, and is not used by default. To configure a 32-bit driver on these systems, use the following steps: Execute: %WINDIR%\syswow64\odbcad32.exe. Create a DSN using the 32-bit version of the Administrator.

Where do I find ODBC Drivers?

Open the Windows Control Panel. Open the Administrative Tools folder. Double-click Data Sources (ODBC) to open the ODBC Data Source Administrator window. Click the Drivers tab and locate the SQL Server entry in the list of ODBC drivers to confirm that the driver is installed on your system.

What is the default port for ODBC?

Used to specify the port number for the connection. 1433 by default.


1 Answers

I had the same problem and fixed it by using the 32-bit ODBC admin to create a 32-bit DSN rather than the 64-bit admin in Administrative Tools which only creates 64-bit DSN which don't work.

The 32-bit ODBC Manager is located at C:\Windows\SysWOW64\odbcad32.exe

See this article "Data source name not found and no default driver specified" on Corey Gilmore's blog.

like image 66
mark.murphy Avatar answered Oct 15 '22 12:10

mark.murphy