Link to home
Start Free TrialLog in
Avatar of OCUBE
OCUBEFlag for United States of America

asked on

How to create system DSN using command line ?

How to create DSN on local pc (ODBC) using command line ?
Avatar of Qlemo
Qlemo
Flag of Germany image

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

ASKER CERTIFIED SOLUTION
Avatar of JustWorking
JustWorking

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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).