943,806 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Marked Solved
  • Views: 1565
  • Perl RSS
Aug 3rd, 2009
0

Problem with perl DBI ODBC driver (bug or misconfig ?) String data right truncation

Expand Post »
Hello,

I'm trying to simply do a SELECT from an ODBC source.
It works perfectly in PHP but not in perl !
Therefore there is no problem at source or at ODBC level, it seems to reside at perl/DBI level...

What I do :

Perl Syntax (Toggle Plain Text)
  1. use DBI;
  2. $dbh = DBI->connect('dbi:ODBC:' . $dsnname, $dbuser, $dbpwd) or...
  3. $sth = $dbh->prepare($sql) or die...
  4. do {
  5. my @row;
  6. my $line=1;
  7. # fetch each row in array
  8. while (@row = $sth->fetchrow_array())
  9. {
  10. print ($line + 1);
  11. print ". ";
  12. # print each field in a row
  13. for ($i=0;$i<$#row;$i++)
  14. {
  15. print $row[$i]
  16. };
  17. print "\n";
  18. $line++;
  19. }
  20. # see if there's more records to show
  21. } while ($sth->{odbc_more_results});

But even if my script is working, most of the time (not always but 80% of time ???) I get this error :

DBD::ODBC::st fetchrow_array failed: [unixODBC][IBM][System i Access ODBC Driver]Column 1: CWB0111 - A buffer passed to a system call is too small to hold return data (SQL-22018) [state was 22018 now 01004]

[unixODBC][IBM][System i Access ODBC Driver]String data right
truncation. (SQL-01004) at ./odbcdemo-perl.pl line n.

I'm not an ODBC expert, not a DBI expert, therefore I'm maybe forgetting something important to be done, but I don't find anything on the web that helped me...

Last idea, could it be due to UTF8, which would create difference in
string sizes ?

I found a similar bug in PHP :
And a thread about my problem but without solution :
But I don't understand DBI enough to understand what I should do ?

Thanks a lot for any help !

Denis
Reputation Points: 10
Solved Threads: 0
Newbie Poster
magix is offline Offline
5 posts
since Aug 2009
Aug 3rd, 2009
0

Re: Problem with perl DBI ODBC driver (bug or misconfig ?) String data right truncation

Just a precision, in my original I didn't forgot the "execute", this is not the problem.

And another precision, I get 27 rows of data (out of 126) before the error arrives...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
magix is offline Offline
5 posts
since Aug 2009
Aug 5th, 2009
0

Re: Problem with perl DBI ODBC driver (bug or misconfig ?) String data right truncation

Reputation Points: 10
Solved Threads: 0
Newbie Poster
magix is offline Offline
5 posts
since Aug 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: Mail::SPF::Query update: make test fails
Next Thread in Perl Forum Timeline: Basic Perl Web Upload Script





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC