DBD::ODBC and issues getting LongTruncOk / LongReadLen to take effect
[email protected] (Daniel Kasak) Thu, 5 Apr 2018 21:24:36 +1000
| Newsgroups | perl.dbi.users |
|---|---|
| Message-ID | <CAF73Y=Rgo9-rOHoNTfo=aijqAy_zHAFh0DJ5E2bg8WtRJY33XQ@mail.gmail.com> |
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:
https://paste.pound-python.org/show/hS6ur7dwGRsQubr29HFT/
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 :)
Dan