Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to test if an ODBC DSN exists?
Message
From
27/12/2003 06:56:01
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00862216
Message ID:
00862227
Views:
18
Hi Joel

>Is there a Windows API that I can use from my VFP code to test if an ODBC DSN exists? For example, say I have an ODBC DSN
called "TrackingDB", how can I test to see if there's an ODBC connection created for this data base?
>
Don't know about an API, but all the information for ODBC connections is stored in the Registry. Information about system DSNs is stored in two sub keys of the “hkey_local_machine\” root key.

The first, “software\odbc\odbcinst.ini”, has one sub key for each driver which lists the settings for that driver. There is also a single sub-key, named “ODBC Drivers”, which lists all installed drivers and could be used to generate a pick-list of available drivers.

The second key, named “software\odbc\odbc.ini”, has one sub key for each DSN that has been defined. Each sub key has entries for the DSN parameters and their values.

Checking the entries under ODBC.INI will tell you whether the specified DSN exists or not...
----
Regards
Andy Kramek
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform