Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9021947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:22:45+00:00 2026-06-16T05:22:45+00:00

How do I programatically get the name of an ODBC driver’s DLL file for

  • 0

How do I programatically get the name of an ODBC driver’s DLL file for a given ODBC driver. For example, given “SQL Server Native Client 10.0” I want to find the name of that driver’s DLL file: sqlncli10.dll. I can see this in REGEDIT in the “Driver” entry in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI. If I try to read the value from the registry in my code it returns an empty string. I also tried using the ODBC API function SQLDrivers. The code below successfully returns all the values of the attributes in the Attribs variable except “Driver”. Everything is there – APILevel, ConnectFunctions, CPTimeout, etc – but “Driver” is not in the list.

repeat
  Status := SQLDrivers (HENV, SQL_FETCH_NEXT, PAnsiChar(DriverName), 255,
            NameLen, PAnsiChar(Attribs), 1024, AttrLen);
  if Status = 0 then begin
    List.Add(DriverName);
    List.Add(Attribs);
  end;
until Status <> 0;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:22:46+00:00Added an answer on June 16, 2026 at 5:22 am

    You can use SQLGetInfo() with InfoType=SQL_DRIVER_NAME

    I hope this will look like:

    Status := SQLGetInfo(ConnEnv, SQL_DRIVER_NAME, PAnsiChar(DriverName), 255, NameLen);
    

    But this function works with already connected database.

    I tried SQLDrives() and you are right: in my environment this function also do not return DLL name. So I tried to read it from registry and it worked this way:

      DLLName := RegGetStringDirect(HKEY_LOCAL_MACHINE, 'SOFTWARE\ODBC\ODBCINST.INI\'  + DriverName, 'Driver');
    

    For driver: IBM INFORMIX ODBC DRIVER I got: C:\informix\bin\iclit09b.dll

    For driver: SQL Server I got: C:\WINDOWS\system32\SQLSRV32.dll

    RegGetStringDirect() is my function based on Windows API to read something from registry.

    EDIT:

    Two functions to read “SQL Server” ODBC driver dll name by Ron Schuster moved from comment:

    procedure TForm1.Button1Click(Sender: TObject); 
    //using Windows API calls 
    var 
      KeyName, ValueName, Value: string; 
      Key: HKEY; 
      ValueSize: Integer; 
    begin
      ValueName := 'Driver';
      KeyName := 'SOFTWARE\ODBC\ODBCINST.INI\SQL Native Client';
      if RegOpenKeyEx(HKEY_LOCAL_MACHINE, PChar(KeyName), 0, KEY_READ, Key) = 0 then
        if RegQueryValueEx(Key, PChar(ValueName), nil, nil, nil, @ValueSize) = 0 then begin
          SetLength(Value, ValueSize);
          RegQueryValueEx(Key, PChar(ValueName), nil, nil, PByte(Value), @ValueSize);
          ShowMessage(Value);
        end;
    end; 
    
    procedure TForm1.Button2Click(Sender: TObject);
    //using TRegistry class 
    var
      KeyName, ValueName, Value: string;
      Reg: TRegistry;
    begin
      ValueName := 'Driver';
      KeyName := 'SOFTWARE\ODBC\ODBCINST.INI\SQL Native Client';
      Reg := TRegistry.Create;
      try
        Reg.RootKey := HKEY_LOCAL_MACHINE;
        if Reg.OpenKeyReadOnly(KeyName) then begin
          Value := Reg.ReadString(ValueName);
          ShowMessage(Value);
        end;
      finally
        Reg.Free;
      end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get the tabView name programatically. What is the property to do
I want to programatically get a Sensor 's name. Say the name of the
I need to get the file name programatically on Mac, am using Selenium to
i want to get the full address of user programatically using c# how can
Whats the earliest point I can programatically get to the name of the masterpage
How can I get the service name programatically using this.ServiceName in a Windows Service
Is there a way to programatically get the name of which method or property
Is there a good way to get the process name that created a file
How do I programatically get my own Firefox extension's version number with Javascript? My
I'm trying to programatically get a list of installed fonts in C or Python.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.