Solved

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

Posted on 2007-12-05
2
2,124 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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…

707 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

18 Experts available now in Live!

Get 1:1 Help Now