Sign in to follow this  
Followers 0
momitty

How to get list of ODBC DSNs?

4 posts in this topic

I can find examples of how to connect and run queries, but not how to get a listing of DSN's. Any ideas?

Thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This is really just a General Help Topic, not GUI related.

They can be found in the registry.

Entries stored here are string values of Data Source names

HKLM\Software\ODBC\ODBC.INI\ODBC Data Sources\

Entries stored here are parameters for data source

HKLM\Software\ODBC\ODBC.INI\{data source name}

#include <Array.au3>

$keyidx = 0
$regroot = "HKLM\Software\ODBC\ODBC.INI\ODBC Data Sources"
Dim $arrDSNs[1]

While 1
    $keyIdx += 1
    $keyName = RegEnumVal($regRoot, $keyIdx)
    If @error = 0 Then
        _ArrayAdd($arrDSNs,$keyName)
    Else
        ExitLoop
    EndIf
WEnd

$arrDSNs[0] = UBound($arrDSNs) - 1
_ArrayDisplay($arrDSNs)
Edited by spudw2k

Share this post


Link to post
Share on other sites

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0