1

When my machine is reimaged or swapped out, I have to take a screenshot of each Data Source in my the Microsoft ODBC Administration tool to make sure I get it right on the new machine. Even going to a coworker's machine, using their settings might not work to connect to the same data sources because we might have different configurations (annoying, to say the least). Rather than taking a screenshot, there must be a way to output all those settings to a text file. Searching for an answer to my question gets me a lot of set-up answers and nothing that just outputs the current settings and configuration. I did find one that might help, if the values are listed in the registry file (http://stackoverflow.com/questions/3417142/command-line-to-change-path-to-mdb-file-for-ms-access-odbc-system-dsn)

Ideally, I'd like to use a batch file or vbscript. I'd like to see the text file say something like:

USER DSN

Data Source Name: MS Access Database

Driver: Microsoft Access Driver

Description:

Database: X:\Path\to\file.mdb

System Database: None

Driver Page Timeout: 5

Driver Buffer Size: 2048

Driver Exclusive: false

Driver Read Only: false

Default Authorization Username:

and so forth...

SYSTEM DSN

Data Source Name: data_warehouse

Driver: Adaptive Server IQ 12

Description:

... including other tabs like this ...

Database Server Name: data_warehouse

Database Start Line:

and so forth...

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134

1 Answers1

1

You could export the registry entries for odbc to a file and import it on the other machines e.g. on my Windows 7 64 bit machine the system data sources are in HKEY_LOCAL_MACHINE\Software\ODBC\odbc.ini. If you only want selective ones you can easily edit the exported file.

Alternatively, you could move to using file dsns. With file dsns you put all the settings for the DSN in a file and connect using FILEDSN=path_to_file instead of DSN=dsn_name.

bohica
  • 5,932
  • 3
  • 23
  • 28
  • Sorry, I should have mentioned that there are only user rights on the machine ... can't install anything and can't open regedit. It is nice to know that registry entries can be exported as text; I've only ever done it as a reg file. Is there a way to export parsed text of the odbc.ini registry key via a batch script or vbscript without having to touch regedit? – undrline - Reinstate Monica Sep 13 '11 at 17:57
  • Then move to file DSNs. All you need to do is create a file with the settings that are in the DSN, copy it to each machine and change to use FILEDSN=path in the connect string. Or do away with DSNs altogether and use DSN-less connections where you app puts all the ODBC driver attributes in the connect string. – bohica Sep 14 '11 at 07:34