1 message in com.mysql.lists.win32: RESOLVED : DBI -> SQL
FromSent OnAttachments
Joris Lambrecht27 Feb 2001 02:22 
Subject:: RESOLVED : DBI -> SQL
From:Joris Lambrecht (jlam@landis.be)
Date:02/27/2001 02:22:33 AM
List:com.mysql.lists.win32

Apparently it works fine if you add something before $dbh->prepare It took me quite some time to figure this out, or rather find some indirect documentation. Instead of LongReadLen the mailinglists mentioned ReadLongLen, crazy after all i guess.

# prepare and execute SQL statement $sqlstatement="SELECT * FROM openview"; # set LongReadLen before you set $dbh->prepare, 4096 is just a working value for my purposes $dbh->{LongReadLen} =4096; $sth = $dbh->prepare($sqlstatement); $sth->execute || die "Could not execute SQL statement ... maybe invalid?";

-----Original Message----- From: Joris Lambrecht [mailto:jlam@landis.be] Sent: Tuesday, February 27, 2001 10:50 AM To: activePerl (E-mail) Cc: Mysql (E-mail) Subject: RE: DBI -> SQL : have i gone crazy ?

The script below worked fine, the response appeared to be slow because the server did not reboot but hung before rebooting. I jumped the conclusion. Fact is though that now the server happily rebooted the script is no longer producing any output.

Guess i'm not made for programming.

Joris

-----Original Message----- From: Joris Lambrecht [mailto:jlam@landis.be] Sent: Tuesday, February 27, 2001 10:19 AM To: activePerl (E-mail) Cc: Mysql (E-mail) Subject: DBI -> SQL

I'm still strugling with limited documentation and/or fail to understand some concepts. I've succesfully written a query using DBI, DBD::ODBC wich returns a row from an SQL database. This is however veerryy sloow. Also it only prints the LAST row in the table. What am i supposed to be doing wrong ?-) Can anyone send some feedback on this ?

use DBI; use DBD::ODBC;

$user='user'; $pwd='pwd';

# open connection to SQL with ODBC $dbh = DBI->connect('dbi:ODBC:prod_DSN',"$user","$pwd");

# set content type for browser output print "content-type : text/html\n\n";

# prepare and execute SQL statement $sqlstatement="SELECT * FROM openview"; $sth = $dbh->prepare($sqlstatement); $sth->execute || die "Could not execute SQL statement ... maybe invalid?";

# Fetch the rows back from the SELECT statement while ( @row = $sth->fetchrow_array() ) { print "Row returned: @row\n"; } # Release the statement handle resources $sth->finish;

# Disconnect from the database $dbh->disconnect; exit;