Hi Dan
Does it make any difference if you put LongReadLen and LongTruncOK next
to RaiseError in the attrs?
On 16/11/18 10:54, Daniel Kasak wrote:
Hi Martin. Sorry for the very long delay. We had abandoned the ODBC
driver in favour of the native DBD::DB2, and I've been working on this
project outside my normal work hours anyway, so got bogged down in other
issues ...
I've uploaded the trace to: https://tesla.duckdns.org/downloads/trace.log
The script I'm using to generate this is:
https://tesla.duckdns.org/downloads/db2_syscat_columns.pl
It dies on the 1st call of $sth->fetchrow_hashref():
DBD::ODBC::st fetchrow_hashref failed: st_fetch/SQLFetch (long
truncated DBI attribute LongTruncOk not set and/or LongReadLen too
small) (SQL-HY000) at db2_syscat_columns.pl
<http://db2_syscat_columns.pl> line 36.
Thanks for your time ...
Dan
On Thu, Apr 5, 2018 at 9:50 PM Martin J. Evans via dbi-users
<dbi-users@perl.org <mailto:dbi-users@perl.org>> wrote:
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 <http://mycode.pl>
and show me the trace.log file.
Martin
--
Ron Savage - savage.net.au