Easysoft
ODBC Drivers for Oracle, SQL Server, Firebird, ISAM, InterBase, Sybase, MS Access & more.

Easysoft ODBC-ODBC Bridge

Why does Perl DBD::ODBC appear to open the DEFAULT data source with OOB?

Article : 00097
Last Reviewed : 19th July 2005
Revision : 1

Since DBD::ODBC 0.21, Perl has required an ODBC driver manager (or at least some of the functions a Driver Manager supplies). In addition, since 0.21 the DBD::ODBC module connection code (dbdimp.c) started calling SQLDriverConnect first with your DSN name and only if that failed called SQLConnect with the same DSN name. The problem is that SQLDriverConnect is supposed to take a list of attributes of the form:

attribute=name;

and a DSN should be specified as "DSN=name;". Perl DBD::ODBC does not appear to append the "DSN=" to the DSN before calling SQLDriverConnect and so the OOB follows ODBC and assumes a DSN=DEFAULT. If the DEFAULT DSN is not found (likely), DBD::ODBC tries calling SQLConnect with the same DSN name but SQLConnect only takes a DSN name and does not require the "DSN=" so this tends to work.

Ifthe time taken to go through this process bothers you change the name on your calls to DBI->connect to "DBI:ODBC:DSN=dsnname". However, one warning here; the db username and db password (second and third arguments to DBI->connect) are ignored when using SQLDriverConnect so you need to put UID=dbuser;PWD=dbpass into the connection string if your database engine requires authentication.

Applies To

Knowledge Base Feedback

* Did this content help you?
Yes
No
Maybe
 
* Please select one option based on your first choice:
I'm very satisfied
I think it will help, but I haven't tried it yet
It is helpful, but I need more information
It is helpful, but hard to understand
Seemed relevant in search results, but didn't help me
The information is incorrect
The page contains one or more broken links
 
  Suggest new content or let us know how we can improve this content:

 
  (* Required Fields)   



© 1993 - 2008 Easysoft Limited. All rights reserved.