Problems connecting to SQL Server using Perl CGI

  • Please help.  I am at my wits end. 

    I have SQL Server 2000 on a Windows 2003 server.  I have my database on a Nmade Instance .  Named Pipes is disabled and only TCP/IP is enabled.  Authentication is set to Windows only.  The server is in Active Directory.

    My web site is on a Windows 2000 server with IIS 5. I have installed the Client Network Utilities and set the alias to TCP/IP also.  I can connect to the SQL server using the Query Analyzer.

    I have downloaded and installed ActiveState's ActivePerl 5.6.1.638-MSWin32-x86.msi on both machines.  I have also installed DBI and DBD:DBC on both machine.  Both machine have MDAC 2.8 installed.

    The code I am using to connect is as follows:

    my $user = 'user';

    my $pass = 'password';

    my $db = "database";

    my $server = "servername\\instancename";

    my $ipadd = "xxx.xx.xx.xxx,xxxx";

    my $driver = '{SQL Server}';

    Option #1

    $DSN = 'driver=$driver;Server=$server;uid=$user;pwd=$pass;database=$db;network=DBMSSOCN;address=$ipadd;';

    $dbh = DBI->connect("dbiDBC:$DSN") or die 'Cannot Open SQL Server Database $DBI::errstr\n';

    Option #2

    $DSN = 'driver=$driver;Server=$server;uid=$user;pwd=$pass;database=$db';

    $dbh = DBI->connect("dbiDBC:$DSN") or die 'Cannot Open SQL Server Database $DBI::errstr\n';

    Option #3

    $dbh = DBI->connect('dbiDBC:driver=$driver:dsn',$user,$pass) or die 'Cannot Open SQL Server Database $DBI::errstr\n';

    Option #4

    $dbh = DBI->connect("dbiDBC:database=$db;server=$server",$user,$pass) or die '$DBI::errstr\n';

     

    From all that I have read and from previous scripts I have written, any of these should work, but I am getting the following error.

    DBI connect('driver=$driver:dsn','user',...) failed: at C:\cgi-bin\CGI.pl line xxx Cannot Open SQL Server Database $DBI::errstr\n at C:\cgi-bin\CGI.pl line xxx.

    Where xxx = the line number of the connection call.

     

    All of my previous scripts have been written for forms where the web server(Apache), database(MySQL), and script(Perl CGI) are all on the same machine.  I am not at all familiar with SQL Server, and am struggling to learn quickly.  PLease and ideas would be greatly appreciated.

    Thank you

    LANAC

  • This was removed by the editor as SPAM

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply