Link to home
Start Free TrialLog in
Avatar of johnclarke
johnclarke

asked on

ODBC and Database Access

I am writing a program where the user connects to a database via ODBC.  When the program starts the user selects the ODBC driver that he\she wishes to use.  Is there a way to find out which database the user has connected to ?  This would be very useful for the program.
Avatar of evansj
evansj

What type of database are you connecting to? SQL or desktop?
Avatar of johnclarke

ASKER

The program will be connecting to SQL databases.

You mean the Alias Name in the BDE or the Database itself like Oracle, Informix etc.?
I mean the Database Name (eg Oracle, Informix, etc).
What initial parameters you have, the Alias Name?
At the moment I am using the BDE which means that I have to use an alias name.  However,  I might decide to use the ODBC access components that are made by ODBCExpress since direct access to ODBC must be quicker than access via the BDE.
I would be grateful for any advice offered regarding either of the above methods for accessing databases via ODBC.
You can use TDatabase.DriverName
ASKER CERTIFIED SOLUTION
Avatar of KirkGray
KirkGray

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
If you are using the BDE then check the native drivers under the native section in the BDE Admin. This provides direct access that's faster than ODBC.
In retospect my answer is off the mark.  I am unsure how to get the database you have connected to using ODBC.  But ODBC32.dll would probably have a function somewhere that would help.
Just create an ODBC data source and select then DSN inside the data aware control under database.