Board index » database » Any Perl / DB2 knowledgeable people out there?

Any Perl / DB2 knowledgeable people out there?

2006-08-23 07:08:24 AM
Hey all,
I'm trying to parse the output from the get_dbsize_info procedure with
a Perl script, using the DBI and the DB2 DBD. Below is the relevant
part of the code:
my $dbsql = "call get_dbsize_info(?,?,?,?)";
my $dbsqlh = $dbh->prepare($dbsql);
$dbsqlh->bind_param_inout(1,\$snapshottimestamp,20,{db2_param_type=>SQL_PARAM_OUTPUT});
$dbsqlh->bind_param_inout(2,\$databasesize,20,{db2_param_type=>SQL_PARAM_OUTPUT});
$dbsqlh->bind_param_inout(3,\$databasecapacity,20,{db2_param_type=>SQL_PARAM_OUTPUT});
$dbsqlh->bind_param(4,-1);
$dbsqlh->execute();
The bind_param_inout steps fail with:
DBD::DB2::st bind_param_inout failed: [IBM][CLI Driver] CLI0144E
Invalid parameter type. SQLSTATE=HY105
Not being a developer, I don't have the complete understanding of this.
However, from what I've read, SQL_PARAM_OUTPUT should be valid.
Anyone know what I'm doing wrong?
thanks,
/T
-
 

Re:Any Perl / DB2 knowledgeable people out there?

Tomas wrote:
Quote
Hey all,

I'm trying to parse the output from the get_dbsize_info procedure with
a Perl script, using the DBI and the DB2 DBD. Below is the relevant
part of the code:

my $dbsql = "call get_dbsize_info(?,?,?,?)";
my $dbsqlh = $dbh->prepare($dbsql);
$dbsqlh->bind_param_inout(1,\$snapshottimestamp,20
{db2_param_type=>SQL_PARAM_OUTPUT});
$dbsqlh->bind_param_inout(2,\$databasesize,20
{db2_param_type=>SQL_PARAM_OUTPUT});
$dbsqlh->bind_param_inout(3,\$databasecapacity,20
{db2_param_type=>SQL_PARAM_OUTPUT});
$dbsqlh->bind_param(4,-1);
$dbsqlh->execute();

The bind_param_inout steps fail with:

DBD::DB2::st bind_param_inout failed: [IBM][CLI Driver] CLI0144E
Invalid parameter type. SQLSTATE=HY105

Not being a developer, I don't have the complete understanding of this.
However, from what I've read, SQL_PARAM_OUTPUT should be valid.

Anyone know what I'm doing wrong?
I'm not entirely sure, no. But I can make a couple of suggestions.
First, I'm not sure if you are using strict. If not, do so.
Second, you may need to also "use DBD::DB2::Constants;" in your current
namespace.
Of course, you may already be doing both of these, but just didn't put them
in your snippet.
-

Re:Any Perl / DB2 knowledgeable people out there?

Constants! Brilliant! That did the trick. I did use strict, but I
didn't think to use Constants.
Thanks!
/T
Darin McBride wrote:
Quote
Tomas wrote:

Quote
Hey all,

I'm trying to parse the output from the get_dbsize_info procedure with
a Perl script, using the DBI and the DB2 DBD. Below is the relevant
part of the code:

my $dbsql = "call get_dbsize_info(?,?,?,?)";
my $dbsqlh = $dbh->prepare($dbsql);
$dbsqlh->bind_param_inout(1,\$snapshottimestamp,20
{db2_param_type=>SQL_PARAM_OUTPUT});
Quote
$dbsqlh->bind_param_inout(2,\$databasesize,20
{db2_param_type=>SQL_PARAM_OUTPUT});
Quote
$dbsqlh->bind_param_inout(3,\$databasecapacity,20
{db2_param_type=>SQL_PARAM_OUTPUT});
Quote
$dbsqlh->bind_param(4,-1);
$dbsqlh->execute();

The bind_param_inout steps fail with:

DBD::DB2::st bind_param_inout failed: [IBM][CLI Driver] CLI0144E
Invalid parameter type. SQLSTATE=HY105

Not being a developer, I don't have the complete understanding of this.
However, from what I've read, SQL_PARAM_OUTPUT should be valid.

Anyone know what I'm doing wrong?

I'm not entirely sure, no. But I can make a couple of suggestions.

First, I'm not sure if you are using strict. If not, do so.

Second, you may need to also "use DBD::DB2::Constants;" in your current
namespace.

Of course, you may already be doing both of these, but just didn't put them
in your snippet.
-