I'm trying to execute a stored procedure that has 3 columns of type nvarchar(max) on the table. However, I'm getting the following error:
Caught exception in H2::Controller::AP->apge "DBD::Sybase::st fetchrow_hashref failed: Server message number=4004 severity=16 state=1 line=48 server=DEV procedure=sp_List text=Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. at /AP.pm line 361."
I've tried to have the columns cast as "varchar(max)" and "text", yet it still fails.
Running the SQL will retrieve the data just fine, but calling the store procedure it errors out.
A temp table has been created that has the type of text for the three columns. Which fails with error:
Caught exception in H2::Controller::AP->apge "DBD::Sybase::st fetchrow_hashref failed: Server message number=4004 severity=16 state=1 line=47 server=DEV procedure=sp_List text=Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. at /AP.pm line 361."
The database connection is:
has 'dbh' => ( is => 'rw', isa => 'DBI::db', default => sub{ return DATABASE::connect( system => 'xx', database => 'xxx', user => 'xxx' ); } );
The call to the stored procedure:
my $sql ="exec tskMngmnt.dbo.sp_List ";
if (defined $a && $a ne "" && $a ne "NONE") {
$sql .= "\@e = $a ";
} else {
$sql .= "\@e = NULL ";
}
Here is the versions of DBI that we have installed:
perl -MDBI -e 'DBI-> installed_versions;'
Perl : 5.018002 (x86_64-linux-thread-multi)
OS : linux (4.4.92-31-default)
DBI : 1.628
DBD::mysql : 4.021
DBD::Sybase : 1.15
DBD::Sponge : 12.010003
DBD::SQLite : 1.50
DBD::Proxy : 0.2004
DBD::Gofer : 0.015327
DBD::File : 0.42
DBD::ExampleP : 12.014311
DBD::DBM : 0.08
The stored procedure should return 1 row of the columns I'm trying to retreive.
It looks from the error message your Perl DBD driver for Sybase has been compiled using "DBLib" which hasn't really been maintained for years. It was replaced with CTLib in the 1990s. DBLib didn't support multi-byte character sets.
You will probably want to upgrade/recompile the DBD Driver or replace it with an ODBC driver from Microsoft who provide such a driver for Linux alongside their MS SQL for Linux offering.
MS SQL Sever ODBC Driver on Linux
If you're using FreeTDS, you might have some mileage by changing the protocol version number as mentioned in this answer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.