Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Confused by DBI:ODBC Driver name

by afoken (Chancellor)
on Jan 05, 2012 at 13:28 UTC ( [id://946395]=note: print w/replies, xml ) Need Help??


in reply to Re: Confused by DBI:ODBC Driver name
in thread Confused by DBI:ODBC Driver name

At first I thought that 'DBI:ODBC:xxxx' should be 'dbi:ODBC:xxx' but it appears after all these years of using DBI and writing DBDs I never knew "DBI" was valid.

I think upper case DBI is tolerated, but not necessarily valid. The DBI docs state:

The $data_source value must begin with "dbi:driver_name:". The driver_name specifies the driver that will be used to make the connection. (Letter case is significant.)

The wording is a little bit problematic here: Is letter case significant only for the driver name or for the entire data source?

At least once in parse_dsn, the DBI docs use a data source string starting with upper case "DBI":

($scheme, $driver, $attr_string, $attr_hash, $driver_dsn) = DBI->parse +_dsn("DBI:MyDriver(RaiseError=>1):db=test;port=42"); $scheme = 'dbi'; $driver = 'MyDriver'; $attr_string = 'RaiseError=>1'; $attr_hash = { 'RaiseError' => '1' }; $driver_dsn = 'db=test;port=42';

Looking at the result of the example, at least parse_dsn() should ignore case for the scheme part of the data source.

It does so at least on Windows (DBI 1.607) and on Linux (DBI 1.6.16):

C:\>perl -MDBI -MData::Dumper -e "print qq[$DBI::VERSION\n],Dumper([DB +I->parse_dsn('DBI:foo:bar')])" 1.607 $VAR1 = [ 'dbi', 'foo', undef, undef, 'bar' ]; C:\>perl -v This is perl, v5.10.0 built for MSWin32-x86-multi-thread Copyright 1987-2007, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. C:\>
> perl -MDBI -MData::Dumper -e 'print "$DBI::VERSION\n",Dumper([DBI->p +arse_dsn("DBI:foo:bar")])' 1.616 $VAR1 = [ 'dbi', 'foo', undef, undef, 'bar' ]; > perl -v This is perl 5, version 12, subversion 3 (v5.12.3) built for x86_64-li +nux-thread-multi Copyright 1987-2010, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. >

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://946395]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-24 04:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found