http://luju.me luju.me 程序员鲁炬 搜狐
通过ResultSetMetaData 对象获取 数据库表结构(字段名称,类型,长度等)
  • package java.sql;
  • /**
  • * An object that can be used to get information about the types
  • * and properties of the columns in a <code>ResultSet</code> object.
  • * The following code fragment creates the <code>ResultSet</code> object rs,
  • * creates the <code>ResultSetMetaData</code> object rsmd, and uses rsmd
  • * to find out how many columns rs has and whether the first column in rs
  • * can be used in a <code>WHERE</code> clause.
  • * <PRE>
  • *
  • * ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
  • * ResultSetMetaData rsmd = rs.getMetaData();
  • * int numberOfColumns = rsmd.getColumnCount();
  • * boolean b = rsmd.isSearchable(1);
  • *
  • * </PRE>
  • */
  • publicinterface ResultSetMetaData extends Wrapper
posted on 2012-11-20 17:48  http://luju.me/  阅读(1024)  评论(0编辑  收藏  举报