Subject: | Unusual slowness when processing JDBC results with next & getString |
I am connecting to a database via JDBC and everything is working
great! However, I feel that is is taking an extremely unusual amount
of time to process the results from my query.
Environment:
Solaris 5.8 Generic_108528-18 sun4u sparc SUNW,Ultra-80
perl v5.8.6
Inline::Java v0.51
JDBC v0.01
Runtime Bechmarks:
If you look at the code below, it take about 21 seconds to process
1100 rows or data. However, if I comment out just the while loop, that
runtime jumps down to around 7 seconds. It seems like a very long time
(14 secs) just to process 1100 rows of data.
Program:
#!/bin/perl
use strict ;
use JDBC ;
JDBC->load_driver('in.co.daffodil.db.rmi.RmiDaffodilDBDriver');
warn "driver loaded" ;
my $url = 'jdbc:daffodilDB://localhost:3456/ovaa';
my $user = 'DAFFODIL';
my $pass = 'daff0d1l';
my $con;
eval {
warn "getting connection" ;
$con = JDBC->getConnection($url, $user, $pass);
warn "got connection" ;
} ;
die $@->getMessage() if $@ ;
my $sql = $con->createStatement();
my $query = 'select nodename, filename, file_type from ovpa_to_node';
my $results = $sql->executeQuery($query);
#This loop is the reason for this programs sluggish behavior
while ($results->next) {
my $node = $results->getString(1);
my $file = $results->getString(2);
my $type = $results->getString(3);
#print "Query Result: $node, $file, $type";
}