Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

MCDE and DBD::ODBC issues

by peschkaj (Pilgrim)
on Nov 07, 2002 at 18:33 UTC ( #211174=perlquestion: print w/replies, xml ) Need Help??
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", "", "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.

Replies are listed 'Best First'.
Re: MCDE and DBD::ODBC issues
by wardk (Deacon) on Nov 07, 2002 at 21:46 UTC
    my ( $data_source, $database, $port, $user_id, $password ) = qw( "PIKA +CHU\NetSDK", "HarvestDay", "", "HarvestReader", "reader +" );
    doesn't produce what you are expecting...

    print them out, you'll see embedded quotes and with some, a comma.

    like $database, it equals:

    this would likely explain "invalid string" good luck!
      Thank you for pointing out my slip-up in such a polite way. ++ to you my friend.

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://211174]
Approved by mr2
[Discipulus]: italian doc says to modify somehow the initial SVG before using it with D3.js
[Discipulus]: LanX the fact is that my js ability is even poorer than my Perl one..
[LanX]: oh its negative? ;P
[Discipulus]: my warmest comprehension karlgoethebier ;=(
[Discipulus]: yes LanX.. is so good to be appreciated (I fortunately have a big self estimation that compensate)
[LanX]: you can manipulate a html tree by addressing and replacing so called document objects (DOM) and from my experience the same methods can be used with any XML, though I didn't test all browsers yet
LanX just joking, playing "ego judo"
[marto]: good morning all

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2017-03-23 09:52 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (285 votes). Check out past polls.