Monday, March 12, 2012

Manual creation of DSNs

I'm trying to adapt the code in the article "How to Create ODBC DSN on
multiple SQL server Machines"
(http://www.databasejournal.com/feat...cle.php/2238221) to
create a script that will automate the creation of SQL Server DSNs.
The article's code writes the DSN to the appropriate location in the
registry--HKLM\SOFTWARE\ODBC\ODBC.INI\<DSN Name>. However, the code doesn't
seem to address how to write the SQL UserID and Password. It appears that
the SQL driver doesn't store that information in the registry.
Any suggestions on how to proceed? Thanks!"Stan" <NoSpam@.I> wrote in message
news:#qSSJ77zDHA.1740@.TK2MSFTNGP09.phx.gbl...
quote:

> I'm trying to adapt the code in the article "How to Create ODBC DSN on
> multiple SQL server Machines"
> (http://www.databasejournal.com/feat...cle.php/2238221) to
> create a script that will automate the creation of SQL Server DSNs.
> The article's code writes the DSN to the appropriate location in the
> registry--HKLM\SOFTWARE\ODBC\ODBC.INI\<DSN Name>. However, the code

doesn't
quote:

> seem to address how to write the SQL UserID and Password. It appears that
> the SQL driver doesn't store that information in the registry.
> Any suggestions on how to proceed? Thanks!

This article was designed to use Trusted Connections -- reference the
TrustedConnection = "yes" entry.
Usually it's not a good idea to embed the user name and password with the
DSN entry. Consider using DSN-less entries if you are writing a VB
application to access SQL Server. Here is a starting point for the
connection strings: http://www.able-consulting.com/ADO_Conn.htm
Steve

No comments:

Post a Comment