getMetaData().getTables() behaviour with JDBC3 8.3 & 8.4 drivers on windows
От | Panon, Paul-Andre |
---|---|
Тема | getMetaData().getTables() behaviour with JDBC3 8.3 & 8.4 drivers on windows |
Дата | |
Msg-id | 84D20D8353A4AB4F96ED08738919009A2BBBDE1C82@SCVANEX7.sierrasys.com обсуждение исходный текст |
Ответы |
Re: getMetaData().getTables() behaviour with JDBC3 8.3 & 8.4
drivers on windows
|
Список | pgsql-jdbc |
The PostgreSQL driver appears to be causing some unexpected behaviour for the OpenNMS installer on Windows. In the following code snippet, the table row set returned includes TABLEs, SEQUENCEs, and INDEXes. Shouldn't getTables befiltering out and returning only tables and views? public void databaseSetUser() throws SQLException { Connection adminConn = getAdminConnection(); ResultSet rs = adminConn.getMetaData().getTables(null, "public", "%", null); HashSet<String> objects = new HashSet<String>(); while (rs.next()) { m_out.println(rs.getString("TABLE_NAME")+" "+ rs.getString("TABLE_TYPE") +" "+ rs.getString("REMARKS")); objects.add(rs.getString("TABLE_NAME")); } PreparedStatement st = getAdminConnection().prepareStatement("ALTER TABLE ? OWNER TO ?"); for (String objName : objects) { st.setString(1, objName); st.setString(2, m_user); m_out.println("Would perform ALTER TABLE " + objName + " OWNER TO " + m_user ); /* st.execute(); */ } st.close(); } ----Notice Regarding Confidentiality---- This email, including any and all attachments, (this “Email”) is intended only for the party to whom it is addressed andmay contain information that is confidential or privileged. Sierra Systems Group Inc. and its affiliates accept no responsibilityfor any loss or damage suffered by any person resulting from any unauthorized use of or reliance upon thisEmail. If you are not the intended recipient, you are hereby notified that any dissemination, copying or other use ofthis Email is prohibited. Please notify us of the error in communication by return email and destroy all copies of thisEmail. Thank you.
В списке pgsql-jdbc по дате отправления: