locked
Microsoft - ODBC Driver Manager - Data source name not found and no default driver specified RRS feed

  • Question

  • I have developed an app in VC++ to make connect to Oracle DB and access its data. It requires a DSN to be created and some environment variables like PATH, ORACLE_HOME, TNS_ADMIN, etc. to be set which I have done programmatically in my VC++ code. I have updated required registry entries. I have installed 32bit Oracle Instant Client on my machine.

    http://download.oracle.com/otn/nt/instantclient/121020/instantclient-basic-nt-12.1.0.2.0.zip
    http://download.oracle.com/otn/nt/instantclient/121020/instantclient-odbc-nt-12.1.0.2.0.zip

    I have complied and built the application exe using Win32 option as target platform on Windows 7 64 bit machine. This exe works fine on Windows 7 64 bit machine and I am able to make the DB connection successfully using SQLDriverConnect().

    But when I do same setup on Windows 32 bit machine like installing 32bit Oracle Instant Client, setting some environment variables like PATH, ORACLE_HOME, TNS_ADMIN, etc., updating required registry entries and try running same application exe (used on 64 bit machine), this gives following error:

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

    Please suggest the resolution steps.


    ModeLearner

    Tuesday, November 22, 2016 4:30 PM

Answers

  • Thanks all for your response.

    Anyways I have fixed the issue.

    As I mentioned earlier that I am creating DSN and updating registry entries for DSN programmatically, registry path should be different for 64 bit machine and different for 32 bit machine.

    On 64 bit machine, DSN registry path would be:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI]

    On 32 bit machine, DSN registry path would be:

    [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI]

    This resolved my issue after making DSN registry entries at new path in registry for 32 bit machine.


    ModeLearner

    • Proposed as answer by Baron Bi Monday, November 28, 2016 6:11 AM
    • Marked as answer by ModeLearner Monday, November 28, 2016 7:39 AM
    Thursday, November 24, 2016 7:29 AM

All replies

  • Have you also used the “ODBC Data Source Administration (32-bit)” system tool to add and manage the data sources?

    Tuesday, November 22, 2016 7:26 PM
  • No. I am creating DSN in code using connstring like DSN=%s;UID=%s;PWD=%s in

    SQLDriverConnect().

    I am also setting environment variables like PATH, TNS_HOME, ORACLE_HOME using _putenv() in code. And this works fine on my 64 bit machine but not on 32 bit machine.

    Additional InfoOn my 64 bit machine, ODBC data source is at C:\Windows\SysWOW64 and on my 32 bit machine, ODBC data source is at c:\windows\system32                                                                                                                                                                                                      


    ModeLearner


    • Edited by ModeLearner Wednesday, November 23, 2016 9:37 AM
    Wednesday, November 23, 2016 9:37 AM
  • Hi ModeLearner,

    Welcome to the MSDN forum.

    Refer to your description, your issue is about the development of C++ project. Since our forum is to discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor, I will help you move it to the appropriate forum: Visual Studio Languages  >  Visual C++ for dedicated information, you will get a more professional support from there, thank you for your understanding.

    Best regards,

    Sara


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 24, 2016 7:07 AM
  • Thanks all for your response.

    Anyways I have fixed the issue.

    As I mentioned earlier that I am creating DSN and updating registry entries for DSN programmatically, registry path should be different for 64 bit machine and different for 32 bit machine.

    On 64 bit machine, DSN registry path would be:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI]

    On 32 bit machine, DSN registry path would be:

    [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI]

    This resolved my issue after making DSN registry entries at new path in registry for 32 bit machine.


    ModeLearner

    • Proposed as answer by Baron Bi Monday, November 28, 2016 6:11 AM
    • Marked as answer by ModeLearner Monday, November 28, 2016 7:39 AM
    Thursday, November 24, 2016 7:29 AM
  • Hi ModeLearner,

    Glad to see you fix it. Please help to mark answer. Your understanding and cooperation will be grateful.

    Best Regards,

    Sera Yu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 28, 2016 6:11 AM