Article

"Data source name not found and no default driver specified" error on connecting using ODBC applications

« Go Back

Information

 
EnvironmentProduct: Connect for ODBC, Sequelink ODBC Client, OpenAccess ODBC Client
Version: All supported versions
OS: All supported platforms
Database: All supported databases
Application: All ODBC applications
Question/Problem Description
When trying to connect to a database, an error is returned indicating that the ODBC data source name could not be found and there is no default driver specified.
Steps to Reproduce
Clarifying Information
Error Message[DataDirect][ODBC lib] Data source name not found and no default driver specified
[INTERSOLV][ODBC lib] Data source name not found and no default driver specified
[MERANT][ODBC lib] Data source name not found and no default driver specified
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Defect/Enhancement Number
Cause
The application is not able to locate the ODBC data source specified in the connection string.  There are a few common causes:
  • Wrong Application Executable and Linking Format (ELF).
  • Misspelling of DSN or Driver
  • Invalid or missing environment configuration
Resolution

Wrong Application Executable and Linking Format (ELF)

It is important that the ODBC driver's executable and linking format (ELF) is the same as the application. In other words, a 32-bit driver is needed for use with  a 32-bit application or a 64-bit driver for a 64-bit application.

If these do not match, it is possible to configure a DSN for a 32-bit driver and when an attempt is made to use that DSN in a 64-bit application, the DSN won't be found because the registry holds DSN information in different places depending on ELF (32-bit versus 64-bit).
 
Be sure to use the correct ODBC Administrator tool. On 32-bit and 64-bit Windows, the default ODBC Administrator tool is in c:\Windows\System32\odbcad32.exe. However, on a 64-bit Windows machine, the default is the 64-bit version. If the 32-bit ODBC Administrator tool is needed on a 64-bit Windows system, run the one found here: C:\Windows\SysWOW64\odbcad32.exe
 

Misspelling of DSN or Driver

This can happen because the data source name or driver name is invalid (such as with a typo in the data source name, in the odbc.ini or the connection string in the application) 

Verify that the name of the ODBC data source in the connection string is identical to an existing ODBC data source.
 

DSN contains special character(s).​

As per the ODBC Specification, a DSN should not contain the []{}(),;?*=!@ characters, and the value of the DSN keyword cannot consist only of blanks. Because of the registry grammar, keywords and data source names cannot contain the backslash (\) character.
 

Invalid or missing environment configuration

The environment may not be configured correctly (such as when the wrong odbc.ini file is being located or there is an error in the structure of the odbc.ini).

Follow the steps below to check the configuration.


1. For applications running on Windows

  • If your application is running as a service on Windows ( eg: Microsoft Internet Information Server IIS ), create a SYSTEM (instead of a USER) ODBC data source name so that the data source is available for all users on the system.
  • When running on x64 windows machines, make sure to install and configure a 32-bit driver when using 32-bit applications, and a a 64-bit driver when using 64-bit applications.
    The 32-bit version of the ODBC administrator tool (odbcad32.exe) file is located in the %systemdrive%\Windows\SysWoW64 folder.
    The 64-bit version of the ODBC administrator tool (also named odbcad32.exe) file is located in the %systemdrive%\Windows\System32 folder.

2. For applications running on Unix/Linux:

  • Verify that the ODBCINI (or ODBC_INI or SHADOW_INI) environment variable points to the correct odbc.ini (or shadow.ini) file in which the ODBC data source is defined. For example:
    export ODBCINI=/opt/odbc32v53/odbc.ini
    • Specify the fully qualified name to your odbc.ini file (path + filename)
    • Environment variable name (such as ODBCINI) must be in uppercase
    • Ensure that the file has read permissions for everyone
    • When launching an application through a batch file or shell script, ensure that the batch file/shell script does not reset the ODBCINI environment variable.
  • Verify that the odbc.ini file is valid.
    • Add a section called [ODBC Data Sources] to your odbc.ini file where the data source names are listed and the corresponding driver description. For example:

      [ODBC Data Sources]
      DB2 Wire Protocol=DataDirect 5.3 DB2 Wire Protocol
      datasourcename=driver description
  • Add the ODBC data source name between square brackets to your odbc.ini and make sure there is a line for the driver. Each option must be specified on its own line. For example:

    [MYDATASOURCENAME]
    Driver=/home/support/soft/odbc32v53/lib/ivdb223.so
    otheroption=optionvalue
 
  • Verify that there are no erroneous extra brackets '[' / ']' in the odbc.ini file.

Execute the following UNIX / Linux command to ensure that the line formatting in the odbc.ini is in UNIX style, not in Windows/DOS style.
dos2unix odbc.ini

 

NOTE: You can use the tools example and demoodbc which ship with Connect and SequeLink software to test your ODBC connectivity outside your own application.
 

3. For SequeLink users:

The source of the error may be the SequeLink ODBC client or the SequeLink Server.

  • When the error reads "[DataDirect][ODBC lib] Data source name not found and no default driver specified." the problem is with the SequLink ODBC Client. Follow the steps in 1 and 2 above.
 
  • When the error reads "[DataDirect][ODBC SequeLink driver][ODBC Socket][DataDirect][ODBC lib] Data source name not found and no default driver specified" the problem is with the SequeLink Server for ODBC Socket and/or ODBC driver configuration on the SequeLink Server
    • Verify that the ODBC connection used by the SequeLink Server for ODBC Socket is working fine. For example, use the tool 'example' which ships with the DataDirect Connect for ODBC drivers to ensure that no errors occur upon connection to your ODBC data source.
    • When the ODBC connection used by the SequeLink Server for ODBC socket is successful using a test tool, verify that the SequeLink ODBC Socket Server service advanced data source variable DataSourceSOCODBCConnStr is pointing to the correct SYSTEM (not USER) ODBC data source name. For example:

      DataSourceMSSODBCConnStr=DSN=your_datasource_name;
      UID=your_user_name;
      PWD=your_password
  • To use a DSN-less connection, ensure the case-sensitive value specified in the Driver= portion does not contain any spaces. For example:
    DataSourceMSSODBCConnStr=Driver={DataDirect 5.3 dBASEFile (*.dbf)};Database=C:\mydata
  • On UNIX/Linux, verify that the following SequeLink ODBC Socket Server service variables have been properly set:

    ServiceEnvironmentVariable ISLVINI=/opt/slserverxx/ipe
    ServiceEnvironmentVariable ODBCINI=/opt/odbcxx/odbc.ini
    ServiceEnvironmentVariable SHLIB_PATH=/opt/odbcxx/lib:/opt/slserverxx/bin
Workaround
Notes
References to Other Documentation: ODBC Programmer's Reference > ODBC Reference > Setup DLL API Reference : https://msdn.microsoft.com/en-us/library/ms709275(v=vs.85).aspx
Attachment 
Last Modified Date4/26/2016 8:46 AM
Disclaimer

The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.



Feedback
 
Was this article helpful?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful.



Characters Remaining: 255