Pramod
Pramod

Reputation: 1

DBI SQL_VARCHAR is not supporting, getting error DBD::ODBC::st bind_param failed: Data type is not supported. [typeId=-9] (SQL-HYC00)

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?

Upvotes: -1

Views: 192

Answers (2)

Pramod
Pramod

Reputation: 1

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;
        }

Upvotes: 0

ikegami
ikegami

Reputation: 386541

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

Upvotes: 1

Related Questions