Solved

BATCH file (*.bat) to create an ODBC machine data source

Posted on 2007-12-05
2
2,132 Views
Last Modified: 2011-09-20
Hello,

I am trying to write a DOS Batch file (*.bat) that will perform the steps of creating an ODBC machine data source, has anyone done this before?

The goal is instead of walking people thru the steps of creating the data source, they can just run this BAT file.

Thanks!
0
Comment
Question by:hpsuser
2 Comments
 
LVL 9

Accepted Solution

by:
asawatzki earned 500 total points
ID: 20416406
You can export the ODBC data source from the Registry.  It would be a subkey of one of the following keys:

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI
HKEY_CURRENT_USER\Software\ODBC\ODBCINST.INI

Once it is exported into a .reg file you can use a batch file that does a command:

Reg Import c:\odbcsource.reg

If its a SQL source you would need to restart SQL to get it to recognize.
0
 

Author Closing Comment

by:hpsuser
ID: 31413017
thanks asawatzki
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server memory sizing - reallocation 16 73
Process mapping 5 52
Server configuration for MS Access - SQL Server app 8 72
Mysql Left Join Case 10 56
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

803 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