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

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

Thread Previous | Thread Next
Tim Bunce
April 26, 2007 01:32
Re: Is PERL --> MS SQL really that difficult?
Message ID:
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=<>;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)"


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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About