d(rs.getString(“COLUMN_NAME”));
}
return columnNameList;
}
public static void main(String[] args) {
DBConnection dbConn = new DBConnection();
Connection conn = dbConn.getConnection();
try {
List
tableList = dbConn.getTableNameList(conn);
for (int i = 0; i < tableList.size(); i++) {
String tableName = tableList.get(i);
System.out.println("Table " + i + " : " + tableName);
List
columnList = dbConn.getColumnNameList(conn, tableName);
for (int j = 0; j < columnList.size(); j++) {
String coulumnName = columnList.get(j);
System.out.println(“Column ” + j + ” : ” + coulumnName);
}
System.out.println(“——-————————————————————————分割线”);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
|