Hi, I am sorry to have to admit to being the author of a very very silly bug in unicode handling in DBD::ODBC. The length of UTF16 encoded data was stored in an unsigned short and this can overflow. An unfortunate side effect of this bug can be corruption in your perl application. I only found this issue this morning and no one has reported it to me as yet. If you are using a unicode enabled DBD::ODBC (the default on Windows) and use strings larger than 64K I strongly suggest you upgrade. The 1.22 release should appear on CPAN mirrors soon.
If you package DBD::ODBC up (e.g., a PPM for ActiveState) I would be pleased if you could expedite repackaging version 1.22. Since 1.21 the changes are: =head2 Changes in DBD::ODBC 1.22 June 10, 2009 Fixed bug which led to "Use of uninitialized value in subroutine entry" warnings when writing a NULL into a NVARCHAR with a unicode-enabled DBD::ODBC. Thanks to Jirka Novak and Pavel Richter who found, reported and patched a fix. Fixed serious bug in unicode_helper.c for utf16_len which I'm ashamed to say was using an unsigned short to return the length. This meant you could never have UTF16 strings of more than ~64K without risking serious problems. The DBD::ODBC test code actually got a *** glibc detected *** /usr/bin/perl: double free or corruption (out): 0x406dd008 *** If you use a UNICODE enabled DBD::ODBC (the default on Windows) and unicode strings larger than 64K you should definitely upgrade now. =head2 Changes in DBD::ODBC 1.21_1 June 2, 2009 Fixed bug referred to in rt 46597 reported by taioba and identified by Tim Bunce. In Calls to bind_param for a given statement handle if you specify a SQL type to bind as, this should be "sticky" for that parameter. That means if you do: $sth->bind_param(1, $param, DBI::SQL_LONGVARCHAR) and follow it up with execute calls that also specify the parameter: $sth->execute("a param"); then the parameter should stick with the SQL_LONGVARCHAR type and not revert to the default parameter type. The DBI docs (from 1.609) make it clear the parameter type is sticky for the duration of the statement but some DBDs allow the parameter to be rebound with a different type - DBD::ODBC is one of those drivers. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com