db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@oracle.com>
Subject Re: JDBC Metadata cursor
Date Wed, 14 Apr 2010 12:48:06 GMT
Ян Программист wrote:
> So, how would I get data from result set? .next() not working! John 
Hi John,

As Knut said, you should remove the fancy positioning calls and just use 
next() to advance your metadata result sets. Also, be aware that the 
first argument to many metadata creators is an SQL catalog name. Derby 
does not support the extra catalog namespace, so the catalog argument 
should always be null. Here is an example of how to use 

import java.sql.*;

public class z
public static void main( String[] args ) throws Exception
Class.forName( "org.apache.derby.jdbc.EmbeddedDriver" );
Connection conn = DriverManager.getConnection( 
"jdbc:derby:memory:dummy;create=true" );
DatabaseMetaData metadata = conn.getMetaData();
ResultSet cursor = metadata.getColumns( null, "SYS", "SYSTABLES", "%" );

while ( cursor.next() )
System.out.println( "Next column is called " + cursor.getString( 4 ) );



Hope this helps,

View raw message