From: | "Panon, Paul-Andre" <Paul-AndrePanon(at)SierraSystems(dot)com> |
---|---|
To: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | getMetaData().getTables() behaviour with JDBC3 8.3 & 8.4 drivers on windows |
Date: | 2010-07-28 04:30:32 |
Message-ID: | 84D20D8353A4AB4F96ED08738919009A2BBBDE1C82@SCVANEX7.sierrasys.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 be filtering 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 and may contain information that is confidential or privileged. Sierra Systems Group Inc. and its affiliates accept no responsibility for any loss or damage suffered by any person resulting from any unauthorized use of or reliance upon this Email. If you are not the intended recipient, you are hereby notified that any dissemination, copying or other use of this Email is prohibited. Please notify us of the error in communication by return email and destroy all copies of this Email. Thank you.
From | Date | Subject | |
---|---|---|---|
Next Message | fortunasliebling | 2010-07-28 07:26:58 | Wrong SqlType for boolean columns |
Previous Message | Guy Rouillier | 2010-07-27 20:57:38 | Re: JPA and desktop apps |