Jump to content
Sign in to follow this  

How to get list of ODBC DSNs?

Recommended Posts


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


Share this post

Link to post
Share on other sites

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

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

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.