Ян Программист 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
DatabaseMetaData.getColumns():
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 ) );
}
cursor.close();
conn.close();
}
}
Hope this helps,
-Rick