We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


How to create system DSN  using command line ?

OCUBE asked
Medium Priority
Last Modified: 2012-05-06
How to create DSN on local pc (ODBC) using command line ?
Watch Question

Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Only way I know of is to import registry keys (or use reg.exe, what is the cmdline equivalent). Best method is to create the DSN once (as a system DSN). and then export following keys:

HKLM\Software\ODBC\ODBC.Ini\ODBC Data Sources

That way you get all relevant settings. In the first export, you only need the line for the single DSN.

Either combine both edited exports to one reg file, and import it directly, or use reg import (whole file) or multiple reg add (single key).

Try this via batch file and/or run command. It will work for system DSN customize names and locations.

ODBCCONF.EXE /a {CONFIGSYSDSN "Microsoft Access Driver (*.mdb)" DSN=YourName;DBQ=\\yourserver\share\trackit.mdb;Description=YourName-Database;}

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

That is much better, but you need to know the complete driver name (should be easy, it's the same as shown when creating a DSN) and DSN string (can be obtained by looking to www.connectionstrings.com).
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.