[EMAIL PROTECTED] wrote:

Hi there,

I figured this would be a pretty common problem, but I didn't see
anything in the FAQ or docs.

We've got a script that uses DBI to connect to SQL Server.

There is a system DSN set up and this already has the username and
password. So do we really need to pass them again, as shown below?

my $db = DBI->connect("dbi:ODBC:$dsn","$db_user_name","$db_password");

We tried the following (removing the username/password parameters),
but we got a connection error.

my $db = DBI->connect("dbi:ODBC:$dsn");

It would be nice (for maintenance) and obviously more secure if we
could pass only the DSN name.

Thanks,
- ML

One approach is to subclass DBI and override the connect method. Put in a password/userid retrieval mechanism and then change all your code to call your new subclass.

Chuck



Reply via email to