Skip site navigation (1) Skip section navigation (2)

getMetaData().getTables() behaviour with JDBC3 8.3 & 8.4 drivers on windows

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: (view raw, whole thread or download thread mbox)
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 ( {
            m_out.println(rs.getString("TABLE_NAME")+" "+ rs.getString("TABLE_TYPE") +" "+ rs.getString("REMARKS"));
        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(); */

----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.


pgsql-jdbc by date

Next:From: fortunaslieblingDate: 2010-07-28 07:26:58
Subject: Wrong SqlType for boolean columns
Previous:From: Guy RouillierDate: 2010-07-27 20:57:38
Subject: Re: JPA and desktop apps

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group