http://www.perlmonks.org?node_id=211174

peschkaj has asked for the wisdom of the Perl Monks concerning the following question:

I'm running MCDE on winXP AS Perl. When I attempt to connect to the database with DBD::ODBC I get the following error: Unable to connect: MicrosoftODBC Driver Manager Invalid string or buffer length (SQL-S1090)(DBD: db_login/SQLConnect err=-1)

here is my code:

use DBI; use CGI; use CGI::Carp qw( fatalsToBrowser ); my $q = new CGI; print $q->header( -type=>"text/html", -charset=>"UTF-8" ), $q->start_html( -title => "myCrap.arg" ), $q->p("This is my thing!"); my ( $data_source, $database, $port, $user_id, $password ) = qw( "PIKA +CHU\NetSDK", "HarvestDay", "127.0.0.1:2433", "HarvestReader", "reader +" ); my $conn_string = "driver={SQL Server}; Server=$data_source; tcpip=$po +rt; Database=$database; UID=$user_id; PWD=$password;"; my $dbh = DBI->connect("dbi:ODBC:$conn_string") or die "Unable to conn +ect: $DBI::errstr\n"; my $sth = $dbh->prepare("SELECT * from harvest") or die "Unable to pre +pare: $DBI::errstr\n"; $sth->execute; while ( my @row = $sth->fetchrow_array ) { foreach my $item ( @row ) { $q->p("$item || "); } } print $q->end_html;

I looked through earlier nodes, but none of the solutions provided seemed to help.

Thanks for your assistance

If you make something idiot-proof, eventually someone will make a better idiot.
I am that better idiot.