FAQ
Hi -

I an having an issue with DBI connecting to a database.

My environment in IIS 4.0, NT4, SP 6a, Perl 5.8.4, with DBI and DBD::ODBC
installed.

when I run a .pl file through the browser, if it does not include a call
the dbi, it runs fine. But add in a call to dbi, and it dies with the
following error:

DBI connect('DSNName','USERNAME',...) failed: [Microsoft][ODBC SQL Server
Driver][DBNMPNTW]ConnectionOpen (CreateFile()). (SQL-08001)
[Microsoft][ODBC SQL Server Driver][DBNMPNTW]ConnectionOpen (CreateFile()).
(SQL-01000)(DBD: db_login/SQLConnect err=-1) at E:\cgi-bin\drehgTest2.pl
line 12

My code looks like this:

#!c:/perl/bin/perl -w

use CGI qw(:all);
use CGI::Carp qw(fatalsToBrowser);
use DBI;

print header;

$data_source="dbi:ODBC:codestriker"; #use DSN
$username="username";
$password="password";

$dbh = DBI->connect($data_source,$username,$password,{RaiseError=>1}) or
die "Cannot connect to MS SQL Server:\n$DBI::errstr\n";

print "hello world";

When i run the same script from command line, it processes with out error.

Can anyone shed light on this?

Thanks,
Doug

Search Discussions

  • Lamb Joseph at Sep 22, 2004 at 9:43 pm
    Make sure that on the ODBC connection for
    "codestriker" on the Advanced tab in Control Panel
    that "Named Pipes" is turned off.

    --- Doug Rehg wrote:
    Hi -

    I an having an issue with DBI connecting to a
    database.

    My environment in IIS 4.0, NT4, SP 6a, Perl 5.8.4,
    with DBI and DBD::ODBC
    installed.

    when I run a .pl file through the browser, if it
    does not include a call
    the dbi, it runs fine. But add in a call to dbi,
    and it dies with the
    following error:

    DBI connect('DSNName','USERNAME',...) failed:
    [Microsoft][ODBC SQL Server
    Driver][DBNMPNTW]ConnectionOpen (CreateFile()).
    (SQL-08001)
    [Microsoft][ODBC SQL Server
    Driver][DBNMPNTW]ConnectionOpen (CreateFile()).
    (SQL-01000)(DBD: db_login/SQLConnect err=-1) at
    E:\cgi-bin\drehgTest2.pl
    line 12

    My code looks like this:

    #!c:/perl/bin/perl -w

    use CGI qw(:all);
    use CGI::Carp qw(fatalsToBrowser);
    use DBI;

    print header;

    $data_source="dbi:ODBC:codestriker"; #use DSN
    $username="username";
    $password="password";

    $dbh =
    DBI->connect($data_source,$username,$password,{RaiseError=>1})
    or
    die "Cannot connect to MS SQL
    Server:\n$DBI::errstr\n";

    print "hello world";

    When i run the same script from command line, it
    processes with out error.

    Can anyone shed light on this?

    Thanks,
    Doug

    =====
    Joseph Lamb



    __________________________________
    Do you Yahoo!?
    Yahoo! Mail - 50x more storage than other providers!
    http://promotions.yahoo.com/new_mail
  • Doug Rehg at Sep 22, 2004 at 10:09 pm
    Perfect! That was it.

    thanks a lot!
    Doug
    At 02:42 PM 9/22/2004 -0700, Lamb Joseph wrote:
    Make sure that on the ODBC connection for
    "codestriker" on the Advanced tab in Control Panel
    that "Named Pipes" is turned off.

    --- Doug Rehg wrote:
    Hi -

    I an having an issue with DBI connecting to a
    database.

    My environment in IIS 4.0, NT4, SP 6a, Perl 5.8.4,
    with DBI and DBD::ODBC
    installed.

    when I run a .pl file through the browser, if it
    does not include a call
    the dbi, it runs fine. But add in a call to dbi,
    and it dies with the
    following error:

    DBI connect('DSNName','USERNAME',...) failed:
    [Microsoft][ODBC SQL Server
    Driver][DBNMPNTW]ConnectionOpen (CreateFile()).
    (SQL-08001)
    [Microsoft][ODBC SQL Server
    Driver][DBNMPNTW]ConnectionOpen (CreateFile()).
    (SQL-01000)(DBD: db_login/SQLConnect err=-1) at
    E:\cgi-bin\drehgTest2.pl
    line 12

    My code looks like this:

    #!c:/perl/bin/perl -w

    use CGI qw(:all);
    use CGI::Carp qw(fatalsToBrowser);
    use DBI;

    print header;

    $data_source="dbi:ODBC:codestriker"; #use DSN
    $username="username";
    $password="password";

    $dbh =
    DBI->connect($data_source,$username,$password,{RaiseError=>1})
    or
    die "Cannot connect to MS SQL
    Server:\n$DBI::errstr\n";

    print "hello world";

    When i run the same script from command line, it
    processes with out error.

    Can anyone shed light on this?

    Thanks,
    Doug

    =====
    Joseph Lamb



    __________________________________
    Do you Yahoo!?
    Yahoo! Mail - 50x more storage than other providers!
    http://promotions.yahoo.com/new_mail

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbi-users @
categoriesperl
postedSep 22, '04 at 9:12p
activeSep 22, '04 at 10:09p
posts3
users2
websitedbi.perl.org

2 users in discussion

Doug Rehg: 2 posts Lamb Joseph: 1 post

People

Translate

site design / logo © 2022 Grokbase