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 222555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:08:17+00:00 2026-05-11T19:08:17+00:00

I have an application that connects via a DSN to an Oracle database. If

  • 0

I have an application that connects via a DSN to an Oracle database.
If the initial attempt to connect fails, then I make sure their DSN exists. If it does not exist, then I create it using the SQLConfigDataSource command.

That command requires the driver name as one of its arguments. On my machine, I have the 11g driver, so the following works:

const
  cDriver = 'Oracle in OraDb11g_home1' + #0;
var
  strAttr: string;
begin
  strAttr := 'DSN=' + DSNName + #0 +
             'SERVER=' + TNSName + #0;
  SQLConfigDataSource(0,ODBC_ADD_SYS_DSN,PChar(cDriver),PChar(strAttr));
end;

But the client machine might have a different version of Oracle, or a different name for their oracle home. How can I tell which driver to use on an arbitrary machine?

I’m using Delphi, but it shouldn’t matter much, since this is just an API call anyway.

  • 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-05-11T19:08:18+00:00Added an answer on May 11, 2026 at 7:08 pm

    I ended up using the list in the registry, as shown here:

    function TDSNManager.GetOracleDriverName: string;
    var
      reg : TRegistry;
      drivers: TStringList;
      i: integer;
    begin
      drivers := TStringList.Create;
      reg := nil;
      try
        reg := TRegistry.Create;
        reg.RootKey := HKEY_LOCAL_MACHINE;
        if reg.OpenKey('SOFTWARE\ODBC\ODBCINST.INI',False) then begin
          reg.GetKeyNames(drivers);
        end;
      finally
        FreeAndNil(reg);
      end;  //try-finally
    
      for i := 0 to drivers.Count - 1 do begin
        if 0 < Pos('ORACLE IN',Uppercase(drivers[i])) then begin
          Result := drivers[i];
          Break;
        end;
      end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an MS Access application that connects to a PostgreSQL database via
I have developed a Mobile application that connect to my Web Servie via RESTful
I have an application that originally needed to connect to Sybase (via ODBC), but
I have an application that connects via https to a SOAP-based web service that
I have a WPF application that connects via a socket to a device and
I have a client/server application that remotely connects to a server via Java's SSLSocket.
I have an client application that connects to the DB via the using clause.
I have an application that connects to a number of SQL Servers for monitoring
I have an Android application that connects to Facebook to request authorization of an
enter code here Hi All, I have a simple windows service application that connects

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.