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.

In reply to MCDE and DBD::ODBC issues by peschkaj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.