Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public static ArrayList getTablesMetadata() throws SQLException{
  2. String table[] = {"TABLE"};
  3. ResultSet rs = null;
  4. ArrayList tables = null;
  5.  
  6. rs = metadata.getTables(null, null, null, table);
  7. tables = new ArrayList();
  8. while(rs.next()){
  9. tables.add(rs.getString("TABLE_NAME"));
  10. }
  11. return tables;
  12. }
  13.  
  14. public static void getColumnsMetadata(ArrayList tables)
  15. throws SQLException{
  16. ResultSet rs = null;
  17.  
  18. -----> for(String actualTable : tables){ <------------------------------
  19. rs = metadata.getColumns(null, null, actualTable, null);
  20. System.out.println(actualTable.toUpperCase());
  21. while(rs.next()){
  22. System.out.println(rs.getString("COLUMN_NAME")+ " "
  23. + rs.getString("TYPE_NAME")+ " "
  24. + rs.getString("COLUMN_SIZE"));
  25. }
  26. System.out.println("n");
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement