I put my username and password in a file (dbinfo) in a secure location,
open it, and pass the variables to my script - dbinfo should not be
accessible from the web!
For example:
use strict;
#Open the Oracle database:
if (!defined(open(DBINFO, "$base/dbinfo"))) {
die "Can't open dbinfo.\n";
}
my($dbline,@dbinfo);
while(defined($dbline = <DBINFO>)) {
chomp($dbline);
push @dbinfo, $dbline;
}
close(DBINFO);
$dbh = DBI->connect('dbi:ODBC:DSN', $dbinfo[0], $dbinfo[1],
{ RaiseError => 1,
AutoCommit => 1,
Taint => 1 }
);
where file dbinfo in your case contains:
user
password
HTH,
Stacy Mader.
mrtlc wrote:
>
> Hello all,
>
> Is there any method to hide the password when we code:
>
> DBI->connect('dbi:ODBC:DSN', 'user', 'password');
>
> I am using SQLServer2K on Win2K, can we set up a trusted connection without
> putting a user id and password? Like the way we run osql or dtsrun using
> the /E option.
>
> Thanks in advance.
>
> Stan L