• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

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.
0
johnclarke
Asked:
johnclarke
  • 3
  • 3
  • 3
  • +1
1 Solution
 
evansjCommented:
What type of database are you connecting to? SQL or desktop?
0
 
johnclarkeAuthor Commented:
The program will be connecting to SQL databases.

0
 
ronit051397Commented:
You mean the Alias Name in the BDE or the Database itself like Oracle, Informix etc.?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
johnclarkeAuthor Commented:
I mean the Database Name (eg Oracle, Informix, etc).
0
 
ronit051397Commented:
What initial parameters you have, the Alias Name?
0
 
johnclarkeAuthor Commented:
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.
0
 
ronit051397Commented:
You can use TDatabase.DriverName
0
 
KirkGrayCommented:
For a list of installed alias's Use GetAliasNames (or something similiar - Method of Session or Database Component).

To get a list of Just ODBC DSN's Use the ODBC32.dll DataSources function.....or have a poke around in the registry..... But I reconmend the first way..

0
 
evansjCommented:
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.
0
 
KirkGrayCommented:
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.
0
 
evansjCommented:
Just create an ODBC data source and select then DSN inside the data aware control under database.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now