Re: DBD::ODBC and issues getting LongTruncOk / LongReadLen to take effect
[email protected] ("Martin J. Evans" via dbi-users) Thu, 5 Apr 2018 12:49:01 +0100
| Newsgroups | perl.dbi.users |
|---|---|
| Message-ID | <[email protected]> |
On 05/04/18 12:24, Daniel Kasak wrote:
> 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
There are some very long columns in that result-set but I can't tell from the unixodbc log alone what has happened.
Can you reduce your perl to the simplest test you can and rerun with
DBI_TRACE=15=trace.log perl mycode.pl
and show me the trace.log file.
Martin