I had to obtain the structure (name, type, and precision for every column) of a table, connected via JDBC using DBI, and this is how I did it:


use strict;
use warnings;
use DBI;
my $host = '';
my $url = 'jdbc:Cache://';

my $dbo = DBI->connect("dbi:JDBC:hostname=$host;port=9001;url=$url", 'username', '***')
or die $DBI::errstr;
my $qry = $dbo->prepare("select * from custom.table");

print "Structure of $table \n\n";
my $num_fields = $qry->{NUM_OF_FIELDS};
for (my $i=0; $i< $num_fields; $i++) { 
  my $field = $qry->{NAME}->[$i];
  my $type = $qry->{TYPE}->[$i];
  my $precision = $qry->{PRECISION}->[$i];
  print "$field, $type, $precision\n";