Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


tclodbc - examining DSNs

tclodbc - examining DSNs

tclodbc - examining DSNs

Working with tclodbc 2.5
If I add a dsn:

CODE --> example

database configure add_dsn $driver [list "DSN=$dsn" "DBQ=$dbfile"]
I can then do:


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.

RE: tclodbc - examining DSNs

OK – I'm not proud of this, but the following gets me pretty close to what I'm after:

CODE --> hack

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 --> more_hacking

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close