Re: Access memo-field causes trouble

by Paul Lang <p_lang(at)makura.com>

 Date:  Thu, 20 Apr 2000 09:49:50 -0700
 To:  "Kamphuijs,
ing. K.G." <K.G.Kamphuys(at)FD.AGRO.NL>
 Cc:  hwg-servers(at)hwg.org
 In-Reply-To:  minlnv002s
  todo: View Thread, Original

perldoc DBI

Then look for a section that describes the attributes.
LongReadLen
LongTruncOk

You should set them to something like
LongReadLen=>2048
LongTruncOk=>1
in your connect statement.

HTH,
Paul

At 02:27 PM 4/20/00 +0200, you wrote:
>Hi all,
>
>I have a nasty problem with connecting an Access database to my web.
>
>Using DBI and DBD-ODBC, I try to read data from an Access database that
>contains a memo field.  When I include this field in the select statement,
>the fetchrow_array-function fails giving the following message:
>
>DBD::ODBC::st fetchrow_array failed: [Microsoft][ODBC Microsoft Access 97
>Driver]Data truncated  (SQL-01004)(DBD: st_fetch/SQLFetch (long truncated)
>err=1) at E:\LNV_scripts\smoelenboek\smoelenboek.pl line 229.
>
>The field is typically filled with 2KB of plain text.  For a few records
>where this field contains only a few words, there is no problem.
>
>Does anyone know how to solve that problem.  Strange enough I was able using
>DBI and an SQL insert command to fill the memo field with this information
>without any problem.
>
>Used code:
>
>$query = "SELECT * FROM $table where $where";
>$dbh = DBI->connect("dbi:ODBC:$datasource") ||  print "connection with
>$datasource failed: $DBI::errstr";
>$sth = $dbh->prepare($query) || print "unable to prepare query $query:
>$DBI::errstr";
>$rc = $sth->execute || print "unable to execute query $query: $DBI::errstr";
>while (@row = $sth->fetchrow_array) {
> print @row;
> }
>$dbh->disconnect;
>
>The code is used in a CGI process using Microsoft IIS4 on NT4, activeperl
>518, with an Access 95 database.  Upgrading to Access 97 didn't solve the
>problem.
>
>Thanks in advance for answering,
>
>-- 
>Koen Kamphuys (k.g.kamphuys(at)fd.agro.nl)
>Tech webmaster of www.agro.nl and www.minlnv.nl 
>***Message created entirely with speech recognition***

Paul Lang
http://www.makura.com/paul/

HWG: hwg-servers mailing list archives, maintained by Webmasters @ IWA