}
}
public Table getTable(String tableName) throws SQLException {
connectionTest(conn);
Table t = new Table(tableName);
ResultSet rs = null;
t.setColumns(new ArrayList<Column>());
try {
DatabaseMetaData dmd = conn.getMetaData();// 获取数据库的MataData信息
/**
* 获取类别
*/
//rs=dbmd.getCatalogs();
/**
* 获取模式
*/
//rs=dbmd.getSchemas();
/**
* 限定获取表的类型
*/
/*String types[]={"TABLE","VIEW"}; */
/**
* MySQL获取表信息
*/
//rs=dbmd.getTables("jxgl", null, null, types);
/**
* Oracle获取表信息
*/
/* rs=dmd.getTables(null, "TCSF", tableName, types); */
/**
* 以下部分为结果集解析
*/
/* ResultSetMetaData rsmd=rs.getMetaData();
int size=rsmd.getColumnCount();
List rows=new ArrayList();
Map item=null;
while(rs.next())
{
item=new HashMap();
for(int i=1;i<=size;i++)
{
item.put(rsmd.getColumnName(i), rs.getString(i));
}
rows.add(item);
}
System.out.println(rows); */
rs = dmd.getColumns(null, Resources.JDBC_USERNAME.toUpperCase(), tableName, null);
getColumns(rs, t);
rs = dmd.getPrimaryKeys(null, null, tableName);
t.setPk(getPk(rs));
} catch (SQLException e) {
throw e;
} finally {
close(conn, null, rs);
}