Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tclodbc - examining DSNs

Status
Not open for further replies.

PinkeyNBrain

IS-IT--Management
Dec 12, 2006
279
US
Working with tclodbc 2.5
If I add a dsn:
Code:
database configure add_dsn $driver [list "DSN=$dsn" "DBQ=$dbfile"]
I can then do:
Code:
foreach tvar [database datasources] { puts $tvar }
and I'll see the $dsn I just added. Is there a way to find the DBQ information? Somethine like a 'database examine $dsn'. I'm trying to make my code more bullet proof and not having it try to rebuild a driver/dsn/dbq combination that already exists.
 
OK – I’m not proud of this, but the following gets me pretty close to what I’m after:
Code:
foreach dsn_driver $dsn_driver_list {
   set dsn    [string tolower [lindex $dsn_driver 0]]
   set driver [string tolower [lindex $dsn_driver 1]]
   set dsn_info($dsn) $driver
}
will get me a $dsn to $driver listing. Then
Code:
foreach dsn [array names dsn_info] {
   database db $dsn
   db tables
}
..At least using MSAccess will give me a path to the *.mdb linked into this $dsn. It's not pretty, but I'm able to move on. Note that I'm using the "string tolower" function because I don't trust Window's indifference to upper/lower case.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top