db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcin Krol <mrk...@gmail.com>
Subject ShutdownException while executing query
Date Mon, 17 May 2010 10:52:49 GMT
Hello everyone,

I'm new to Derby and don't know what I'm doing wrong: I have an app that 
produces a temporary file, loads it into Derby (with 
SYSCS_UTIL.SYSCS_IMPORT_TABLE), creates some indexes, and then executes 
a simple query:

ResultSet res = derbyst.executeQuery("SELECT COUNT(*) FROM TMP_CVER");
printoutResultSet(res);

printoutResultSet just iterates over result set rows.

After printoutResultSet the program terminates.

The thing is I'm frequently getting ShutdownExceptions when 
printoutResultSet is executing.

It looks as if execution flew by printoutResultSet and finalized my 
class which caused .next() method on result set to throw an exception: I 
do get class finalization diagnostic printouts.

But I'm not doing any multithreaded programming in this program. I'm 
puzzled as to what could cause this.


private void printoutResultSet(ResultSet rs) throws SQLException {
     if (rs != null)
     {
         logger.trace("Result:");

         ResultSetMetaData md = rs.getMetaData();
         int colcount = md.getColumnCount();
         while (rs.next())
         {
             String line = "";
             for (int i = 1; i <= colcount; i++)
                 line += rs.getString(i) + ", ";
             System.out.println(line);
         }
     } else
         logger.trace("null ResultSet after executing h2 Query");
}



-- 

Regards,
mk

--
Premature optimization is the root of all fun.

Mime
View raw message