Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Re: connecting Perl with MS SQL Server on NT using ODBC

by x-c-ute-o-ner (Initiate)
on Nov 17, 2002 at 07:27 UTC ( #213531=note: print w/replies, xml ) Need Help??

in reply to Re: connecting Perl with MS SQL Server on NT using ODBC
in thread connecting Perl with MS SQL Server on NT using ODBC

Excuse me... I tried many time using your sample code for ODBC, but there is an error everytime i tried to use this code:
#!/usr/bin/perl -w use strict; use DBI; # Module connection for ODBC # Set up variables for the connection my $server_name = "shadow"; my $server_ip = ""; my $database_name = "Smart Response System"; my $database_user = "cs59173"; my $database_pass = "5055"; my $DSN = "driver={SQL Server};server=$server_name;tcpip=$server_ip;da +tabase=$database_name;uid=$database_user;pwd=$database_pass"; my $DBH = DBI->connect("DBI:ODBC:$DSN") or die "Couldn't open database +: $DBI::errstr\n";
The error message is:

DBI->connect(driver={SQL Server};server=shadow;tcpip=;database=Smart Response System;uid=cs59173;pwd=5055) failed: MicrosoftODBC Driver Manager Invalid string or buffer length (SQL-S1090)(DBD: db_login/SQLConnect err=-1) at c:\Perl\SRS\ line 13

FIY, i have tried also sequence of examples by other monks, but also failed. Could you please help tracing the problems? Thanx a lot...

Replies are listed 'Best First'.
Re: Re: Re: connecting Perl with MS SQL Server on NT using ODBC
by Mission (Hermit) on Nov 19, 2002 at 15:43 UTC

    Sorry that I don't see an obvious error in this code. I do have a couple of questions that might help your debugging. Just look through the list and make sure you have the correct information.

    • The conection is expecting a MS SQL server connection, is that your correct database type?
    • Did you try to re-install the (module) and (driver) on the server and on your testing machine using PPM?
    • Are you certain of the IP?
    • Did you double check your Username, PWD?
    • Is the database name correct? (BTW: None of my databases have spaces in their names. That doesn't mean that it won't work like that, but I've not tried that before. You may want to rename you database to something without spaces.)

    I don't see an error, and those questions are just to get you thinking on the debugging process. I hope you have good luck on this problem. If there is any progress, or different problem, please make sure you post the final solution, or additional problems.


    - Mission
Re^3: connecting Perl with MS SQL Server on NT using ODBC
by Anonymous Monk on Mar 15, 2017 at 21:56 UTC
    Not sure if its too late to reply this post, but always useful for current users facing similar problem.

    Scenario 1: If DB connection is not successful while running perl code from cmd, please make sure you have perl driver installed.

    Scenario 2: If DB connect is successful while running perl code from cmd and getting failed from Apache, please make sure to have appropriate driver in System DSN. Driver will depend upon DB you are trying to connect.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://213531]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2018-05-27 16:48 GMT
Find Nodes?
    Voting Booth?