How to check if an OLEDB driver is installed on the system?

Karl-Otto Rosenqvist picture Karl-Otto Rosenqvist · Sep 22, 2008 · Viewed 53.5k times · Source

How can I make sure that a certain OLEDB driver is installed when I start my application? I use ADO from Delphi and would like to display a descriptive error message if the driver is missing. The error that's returned from ADO isn't always that user-friendly.

There are probably a nice little function that returns all installed drivers but I haven't found it.

Answer

Rogerio Ueda picture Rogerio Ueda · Sep 28, 2012

This is an old question but I had the same problem now and maybe this can help others.

In Delphi 7 there is an procedure in ADODB that return a TStringList with the provider names.

Usage example:

names := TStringList.Create;
ADODB.GetProviderNames(names);

if names.IndexOf('SQLNCLI10')<>-1 then
  st := 'Provider=SQLNCLI10;'
else if names.IndexOf('SQLNCLI')<>-1 then
  st := 'Provider=SQLNCLI;'
else if names.IndexOf('SQLOLEDB')<>-1 then
  st := 'Provider=SQLOLEDB;';