copy DSN

G

Guest

Is there a safe, reasonably easy way to copy DSN's once they've been created?
We have to re-create them every time a new user at a new PC has to work with
one of our databases and it's time consuming and a bit of a pain.

TIA.
 
G

Guest

The vast majority of our ODBC's are in the Machine Data Source tab. (One of
my coworkers wrote a tool to make generation easier and this is where they
go).
 
6

'69 Camaro

Hi.
Is there a safe, reasonably easy way to copy DSN's once they've been
created?

We found a fairly painless way to do this. We just run a VBScript remotely
to create DSN's on each of the workstations that need them. The following
VBScript will create a System DSN on a Windows XP workstation, name it
TrgSched, connect to the CAL-SQL01 SQL Server, point to the Training
database, and assign Joe as the login name. When we don't want the DSN to
be visible in the ODBC manager, we don't write the ODBC Data Sources Windows
Registry key.

(Watch out for word wrap.)

Dim objWS

Set objWS = CreateObject ("WScript.Shell")

objWS.RegWrite
"HKLM\Software\ODBC\ODBC.INI\TrgSched\Driver","C:\WINDOWS\System32\sqlsrv32.dll"
objWS.RegWrite "HKLM\Software\ODBC\ODBC.INI\TrgSched\Server","CAL-SQL01"
objWS.RegWrite "HKLM\Software\ODBC\ODBC.INI\TrgSched\Database","Training"
objWS.RegWrite "HKLM\Software\ODBC\ODBC.INI\TrgSched\LastUser","Joe"
objWS.RegWrite "HKLM\Software\ODBC\ODBC.INI\ODBC Data
Sources\TrgSched","SQL Server"

set objWS = Nothing


HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

Thanks, but we have something like this in a Web environment. What I want to
be able to do is go to a machine where system DSN's are running, copy them
and move them to another machine.
 
6

'69 Camaro

Hi.
What I want to
be able to do is go to a machine where system DSN's are running, copy them
and move them to another machine.

System DSN's are stored in the Windows Registry in the LM hive. You'll need
to write the code that reads the Windows Registry for the ODBC keys, and
then outputs a script such as the one I suggested to you, then run that
script on the other workstations.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top