Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5147
  • Last Modified:

How to create system DSN using command line ?

How to create DSN on local pc (ODBC) using command line ?
0
OCUBE
Asked:
OCUBE
  • 2
1 Solution
 
QlemoC++ DeveloperCommented:
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
HKLM\Software\ODBC\ODBC.ini\<<DSN-Name>>

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

0
 
JustWorkingCommented:
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;}
0
 
QlemoC++ DeveloperCommented:
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).
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now