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.
What type of database are you connecting to? SQL or desktop?
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.?
ASKER
I mean the Database Name (eg Oracle, Informix, etc).
What initial parameters you have, the Alias Name?
ASKER
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.