db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ян Программист <webautoma...@gmail.com>
Subject Re: JDBC Metadata cursor
Date Thu, 15 Apr 2010 09:08:19 GMT
Here is the output of your example class "z":

Next column is called TABLEID
Next column is called TABLENAME
Next column is called TABLETYPE
Next column is called SCHEMAID
Next column is called LOCKGRANULARITY

Interesting, but my code started to work:

public final void testGetColumns() throws SQLException {
java.sql.ResultSet column_set = metadata.getColumns(null, "SYS",
"SYSTABLES", "%");
//For scrollable result set:
//For updatable result set:
//int i=0;
//while ( column_set.next() )
String column_name = column_set.getString(3);


JUnit test reporter indicates this test passed("green" state).
System.out.prinln() pushed following into output stream:


The same is for while() loop.

Thanks help. The courious thing is that I remember exactly that in one of my
previous tryouts there where only next(), but an exception about undefined
cursor state fired. Hm,..
By the way - metadata connection was properly defined in setUp().

P.S. In normal unit tests it is a bad idea to write into System.out
stream. Normally it should be written into logger (Log4j). Otherwise, in
some cases, benchmarks would not be usable; if data writing operation would
take much more time than assertions. John

View raw message