How to create system DSN  using command line ?

Posted on 2009-02-10
Last Modified: 2012-05-06
How to create DSN on local pc (ODBC) using command line ?
Question by:OCUBE
    LVL 67

    Expert Comment

    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).

    LVL 8

    Accepted Solution

    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;}
    LVL 67

    Expert Comment

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Suggested Solutions

    Can I legally transfer my OEM version of Windows to another PC?  (AKA - Can I put a new systemboard in my OEM PC?) Few of us are both IT and legal experts but we all have our own views of Microsoft's licensing rules and how they apply.  There are…
    This is an article about Leadership and accepting and adapting to new challenges. It focuses mostly on upgrading to Windows 10.
    This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
    The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now