develooper Front page | perl.dbi.users | Postings from April 2018

DBD::ODBC and issues getting LongTruncOk / LongReadLen to takeeffect

Thread Next
Daniel Kasak
April 5, 2018 11:24
DBD::ODBC and issues getting LongTruncOk / LongReadLen to takeeffect
Message ID:
Hi all.

I'm writing a database utility that has to access IBM's "DashDB" and other
DB2-variants. I have their latest ODBC driver, and I have simple queries
working. However queries against their system catalog are not working -
queries appear to be returning *empty* recordsets. After some laborious
debugging, I can see that when I call $sth->fetchrow_array, DBI::errstr is
set to:

st_fetch/SQLFetch (long truncated DBI attribute LongTruncOk not set and/or
LongReadLen too small) (SQL-HY000)

I've dealt with this before. So when constructing my $dbh, I do:

$self->{dbh}->{LongReadLen} = 65535 * 1024 # 64MB - yes I know it's big
$self->{dbh}->{LongTruncOK} = 1;

This usually fixes things - or at least has for SQL Server and Netezza. For
DB2 connections however, it appears to have no effect.

I've turned on ODBC tracing immediately prior to calling $sth->prepare ...
$sth->execute ... $sth->fetchrow_array:

This one was from the query:
select * from SYSCAT.COLUMNS

Does anyone know why LongTruncOk / LongReadLen are not being honored here?

I'm using unixODBC-2.3.6, DBD::ODBC from git, and the latest available DB2
ODBC driver.

Please help! Thanks :)


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About