On the other hand, if you need to pass connection attributes (LongReadLen, LongTruncOK, RaiseError, etc....) you may need to put in empty strings for the user name and password: $dbh=DBI->connect($connect_string, '', '', %attr); Or is it undefs? I never touch the ODBC stuff myself.
HTH, jeff On Fri, 2002-09-06 at 03:39, [EMAIL PROTECTED] wrote: > > On 05-Sep-2002 Levine, Peter W wrote: > > Hi, > > > > Why do I need to supply user name and password with DBI->connect() if I am > > using DBD:ODBC? This information is already supplied in the DSN? > > > > my $DSN="dbi:ODBC:sqlserver_dsn"; > > my $DBI_USER="Why do I need this?" > > my $DBI_PASS="Why do I need this?" > > > > $dbh=DBI->connect($DSN,$DBI_USER,$DBI_PASS); > > > > Peter Levine > > [EMAIL PROTECTED] > > (415) 286-5716 > > It depends on the driver. > > DBI->connect is mapped in ODBC to SQLConnect(dsn,username,password) or > SQLDriverConnect(connection_string). If you are using SQL Server you have two > ways in which you can create a DSN: > > [1] using NT authentication (trusted connections) > [2] using a database username/password > > For [1] a database username/password is not required but the process accessing > the DSN has to have the correct NT authentication. For [2] a database > username/password is required and must be passed to DBI->connect. > > For MS Access, mdbs don't usually have any username/password associated with > them (although they can). > > A similar situation exists for other ODBC drivers. Most only require a > username/password if the database they are going to have users defined. > > Where the driver doesn't need a username/password don't pass one to > DBI->connect. > > Martin > -- > Martin J. Evans > Easysoft Ltd, UK > Development >
