I am using Gridgain as database. Perl script is written to read data from xml and insert/update the data to Gridgain database.
Passing XML data as hash to following line of code
use DBI;
use DBD::ODBC;
use DBI qw(:sql_types);
use POSIX;
{$sthHandl}->bind_param($Bindpos,$BindHashRef->{$Bindpos}->{'BINDVAL'},{TYPE => $BindHashRef->{$Bindpos}->{'BINDPOSTYPE'}}) or $ST = 1;
Here: $BindHashRef->{$Bindpos}->{'BINDPOSTYPE'}
is the string SQL_VARCHAR
.
Script throwing following error when executed:
DBD::ODBC::st bind_param failed: Data type is not supported. [typeId=-9] (SQL-HYC00)
How to resolve this issue?
CodePudding user response:
You say you are passing the string SQL_VARCHAR
, but the correct value is the number twelve.
$ perl -Mv5.10 -e'use DBI qw( :sql_types ); say SQL_VARCHAR;'
12
CodePudding user response:
Issue resolved after modifying code as below:
if ($BindHashRef->{$Bindpos}->{'BINDPOSTYPE'} eq "SQL_VARCHAR") { {$sthHandl}->bind_param($Bindpos,$BindHashRef->{$Bindpos}->{'BINDVAL'},{TYPE => DBI::SQL_VARCHAR}) or $ST = 1; } else { {$sthHandl}->bind_param($Bindpos,$BindHashRef->{$Bindpos}->{'BINDVAL'},{TYPE => $BindHashRef->{$Bindpos}->{'BINDPOSTYPE'}}) or $ST = 1; }