日期:2014-05-16  浏览次数:20390 次

jdbc获得所有数据库表
	public static void displayTable()throws Exception{
		java.sql.ResultSet rs=null;
		java.sql.Connection con=null;
		java.sql.PreparedStatement ps= null;
		try{
			con=org.apache.commons.dbutils.DbUtils.getDataSource().getConnection();
			java.sql.DatabaseMetaData dm=con.getMetaData();
			rs=dm.getTables(null, "%", "%", new String[]{"table"});
			while(rs.next()){
				System.out.println(rs.getString("table_name"));
			}
		}finally{
			org.apache.commons.dbutils.DbUtils.closeQuietly(con);
		}
		
	}

?