I have encountered a problem and was wondering if the high priests could diagnose it and let me know how to fix. Basically, I am trying to write to an Access memo field and find that I cannot go beyond 255 characters (even with LongReadLen set to a higher value). I have included a sample script that demonstrates the problem along with the stdout. The specific error I get is: PERL DBD Error - Invalid precision value (SQL-S1104)(DBD: _rebind_ph/SQLBindParameter err=-1 I am running: Win98 DBI.pm (v1.14) ODBC (v0.28) PERL (5.6.0.618) Any help would be appreciated. Thanks.
use File::Basename; use DBI; my ($dbase) = @ARGV; # Access Table definition # Table name=blob # field1=recid,integer # field2=name,text # field3=mymemo,memo # # Establish database and connect... my $DSN = "driver=Microsoft Access Driver (*.mdb);dbq=$dbase"; my $dbh = DBI->connect("dbi:ODBC:$DSN","","") or die "$DBI::errstr\n"; # Set up longreadlen so we can do more than the default of 80... # Really does not solve the problem, but here it is... $dbh->{LongReadLen} = 2000; # Build some strings my $fifty = "12345678901234567890123456789012345678901234567890"; my $twoHundredFifty = "$fifty$fifty$fifty$fifty$fifty"; my $twoHundredFifty3 = join '',"$twoHundredFifty","123"; my $twoHundredFifty4 = join '',"$twoHundredFifty","1234"; my $twoHundredFifty5 = join '',"$twoHundredFifty","123**"; my $twoHundredFifty6 = join '',"$twoHundredFifty","123***"; my $fiveHundred3 = join '',"$twoHundredFifty","$twoHundredFifty","***" +; # Do some clean up... $dbh->do("delete from blob"); # Define sql statement for updating memo field. $sql = "insert into blob (name,mymemo) values(?,?)"; # Bind values to statement and execute... # This one should work... $dbh->do($sql,undef,"first",$twoHundredFifty5); my $error = $dbh->errstr; print("Errorstring 1 = >$error<\n"); # Bind values to statement and execute... # This one will fail... $dbh->do($sql,undef,"second",$twoHundredFifty6); my $error = $dbh->errstr; print("Errorstring 2 = >$error<\n"); # Define sql statement for updating memo field. $sql = "update blob set mymemo=? where name=?"; # Bind values to statement and execute... # This one fails... $dbh->do($sql,undef,$twoHundredFifty6,"first"); my $error = $dbh->errstr; print("Errorstring 3 = >$error<\n"); exit; STDOUT Errorstring 1 = >< Errorstring 2 = >[Microsoft][ODBC Microsoft Access Driver]Invalid prec +ision value (SQL-S1104)(DBD: _rebind_ph/SQLBindParameter err=-1)< Errorstring 3 = >[Microsoft][ODBC Microsoft Access Driver]Invalid prec +ision value (SQL-S1104)(DBD: _rebind_ph/SQLBindParameter err=-1)<

In reply to DBI problem with Access's Memo field by cromedome

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.