그래서 테이블 편집 기능이 필요한 프로젝트에 Vaadin Java 웹 프레임 워크를 사용하고 있습니다. 만약 angel 내가 DatabaseMetaData
개체를 얻을 수있는 Connection
에서 Connection
SimpleJDBCConnectionPool
(Here's the API)에서 객체DatabaseMetaData를 사용하여 mysql 테이블 주석 가져 오기
을 얻을 수있는 방법을 제공합니다. 그리고 나는 다음과 같은 코드가 있습니다
private List<String> getTableNames(DatabaseMetaData md) throws SQLException {
ArrayList<String> tables = new ArrayList<String>();
ResultSet rs = md.getTables(null, null, "", null);
while (rs.next()) {
tables.add(rs.getString("TABLE_NAME")); //Column 3 is for table name
Logger.getLogger(CodeContainingClass.class.getName()).
info("Comment: " + rs.getString("REMARKS")); //Column 5 is for remarks
}
return tables;
}
이 올바르게 테이블 이름을 검색을하지만, 불행하게도 REMARKS 반환 null
. (Here's the API). 내가 뭘 잘못하고 있는지 모르겠다.
SHOW TABLE STATUS WHERE Name='tablename';
어떤 도움이 크게 감사합니다 :
나는 테이블이 다음과 같은 쿼리를 사용하여 주석을 가지고 있음을 확인했습니다. 고맙습니다.
참조하십시오. – Monir
''% ''또는''null'로''TableNamePattern' 매개 변수 값을 대체해야 할 수도 있습니다. –
감사합니다. "%"이 (가) 작동했습니다. – Monir