Link to home
Start Free TrialLog in
Avatar of Joe Overman
Joe OvermanFlag for United States of America

asked on

checking for a specific ODBC connection

I need a way to check for an existing ODBC connection in the odbc data source administrator.  All the research I have done indicates that the values are stored in either the INI file (not in XP) or the registry.  I have determined that the ini file does not exist and I do not have access to the registry on this computer so my search skills are limited here.  What I would like an easy way to see if the the connection named "tempconn" exists in the registry so that my code does not update the connection information when I use RegisterDatabase to establish the missing connection.  This is all being done on an xp system (soon to be vista) inside a ms access database.
Avatar of rockiroads
rockiroads
Flag of United States of America image

What code are you currently using, r u using the sqlconfig... api? if so then could you not try to open as edit. If it failed then try to add on. If that fails then summat is knackered or it already exists!
ASKER CERTIFIED SOLUTION
Avatar of vincem1099
vincem1099
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
> the ini file does not exist and I do not have access to the registry on this computer ..

Then you are left with trial and error.
Open a connection assuming your DSN exists. Catch an error.
If no error is catched, the DSN exists.

/gustav
Avatar of Joe Overman

ASKER

That is just what I need.  Thanks