private List<Table> gainTables() throws SQLException {
		List<Table> tables = new ArrayList<Table>();
		try {
			ResultSet rs = null;
			// 所有表
			rs = connection.getMetaData().getTables(null, null, null, null);
			while (rs.next()) {
				Table t = new Table();
				t.setTableName(rs.getString("TABLE_NAME"));
				t.setRemarks(rs.getString("REMARKS"));
				logger.info("tableName:{}", t.getTableName());
				tables.add(t);
			}
			rs.close();
			
			// 所有表中的列
			for (Table table : tables) {
				// 主键
				ResultSet rsp = connection.getMetaData().getPrimaryKeys(null, null, table.getTableName());
				List<String> pks = new ArrayList<String>();
				while (rsp.next()) {
					pks.add(rsp.getString("COLUMN_NAME"));
				}
				rsp.close();
				rsp = null;
				// 列
				rs = connection.getMetaData().getColumns(null, null, table.getTableName(), null);
				while (rs.next()) {
					Column c = new Column();
					c.setName(rs.getString("COLUMN_NAME"));
					if (pks.contains(c.getName())) {
						c.setPrimaryKey(true);
					}
					int dataType = rs.getInt("DATA_TYPE");
					c.setClz(toBeanType(dataType));
					int nullable = rs.getInt("NULLABLE");
					if (DatabaseMetaData.columnNullable == nullable) {
						// 明确指出可以为空
						c.setNullable(true);
					} else {
						c.setNullable(false);
					}
					c.setDef(rs.getString("COLUMN_DEF"));	// 默认值
					c.setAutoIncrement("YES".equals(rs.getString("IS_AUTOINCREMENT")));
					
					c.setRemarks(rs.getString("REMARKS"));	// 注释
					logger.info("tableName:{}; column:{}", table.getTableName(), c.getName());
					table.getColumns().add(c);
				}
				rs.close();
			}
			
		} catch (SQLException e) {
			throw e;
		} finally {
			try {
				connection.close();
			} catch (SQLException e) {
			}
		}
		return tables;
	}