Also...

> 
> > > 
> > > The only situation I've seen that can be a little 
> confusing is this:
> > > 
> > > DBI->connect('dbi:ODBC:dsnname', 'dbuser', 'dbpass')
> > > 
> > > works
> > > 
> > > and
> > > 
> > > DBI->connect('dbi:ODBC:DSN=dsnname', 'dbuser', 'dbpass')
> > > 
> > > fails with whatever message the database engine returns 
> for invalid
> > > user/password (in MS SQL Server it is something to do with 
> > NULL user).
> > > 
> > > First time I hit this it took a little head scratching to work out
> > > what was going on. In the first case SQLConnect('dsnname', 
> > 'dbuser',
> > > 'dbpass') is called and as the database engine required a
> > > username/password all was OK. In the second case 
> > SQLDriverConnect(...,
> > > "DSN=dsnname", ...) was called and I got the NULL user
> > error. Adding
> > > ";UID=dbuser;PWD=dbpass;" to the "DSN=dsnname" fixes the
> > problem but
> > > it can be a little confusing if you don't recognise the problem.
> > > 
> > > Perhaps a note about this in the docs might help.
> > 
> > Or better still, the DBD::ODBC driver could add
> > ";UID=dbuser;PWD=dbpass;" to the $dsn automatically if it 
> > sees that it matches /\bDSN=/.
> 
> Hmm...wouldn't it be better to add before all 
> SQLDriverConnect actions if (defined($uid) && !($dsn =~ 
> /UID=/)) ?? (and leaving DSN alone if we're going to call 
> SQLConnect(), since that is second in the sequence...
> 
> I would think this would be safer than just checking for DSN=

Are UID and PWD consistent across all dbs?  I've tried this with DB2 and
found it doesn't seem to like it.

Jeff


Reply via email to