develooper Front page | perl.dbi.users | Postings from April 2007

Re: Is PERL --> MS SQL really that difficult?

Thread Previous | Thread Next
From:
Tim Bunce
Date:
April 26, 2007 01:32
Subject:
Re: Is PERL --> MS SQL really that difficult?
Message ID:
20070426083227.GB11416@timac.local
On Wed, Apr 25, 2007 at 05:24:40PM -0400, Robert Denton wrote:
> 
> $dbh = DBI->connect( $data_source, $username, $password );
> 
> And my $data_source var is set to this:
> 
> my $data_source = 'driver={SQL Server};Server=<192.168.0.149>;database=<userFeedback>;uid=<testUser>; pwd=<testPass>;';

That needs to have "dbi:ODBC:" at the start.

It's confusing because there term 'data source' (or DSN, Data Source Name)
refers to two different things: the "DBI DSN" and the "Driver DSN".

What you're using is the Driver DSN. Adding the dbi:ODBC: prefix turns
it into a DBI DSN.

Read the connect() section of the DBI docs again and let me know how it
could be improved.

For DBI 1.55 I've changed the message to read:

    "Can't connect to data source '$dsn' because I can't work out what driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and DBI_DRIVER env var is not set)"

Tim.

p.s. I've no idea if the value your using for $data_source is valid,
I just know DBI->connect needs the "dbi:ODBC:" at the start.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About