Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ztbdl-0002xm-0c for pgsql-jdbc@arkaria.postgresql.org; Tue, 03 Nov 2015 13:28:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Ztbdk-0005Cz-6L for pgsql-jdbc@arkaria.postgresql.org; Tue, 03 Nov 2015 13:28:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZtbYY-0004sd-Mt for pgsql-jdbc@postgresql.org; Tue, 03 Nov 2015 13:23:22 +0000 Received: from mbob.nabble.com ([162.253.133.15]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZtbYV-0006Hk-M3 for pgsql-jdbc@postgresql.org; Tue, 03 Nov 2015 13:23:22 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mbob.nabble.com (Postfix) with ESMTP id E1F171916664 for ; Tue, 3 Nov 2015 05:12:43 -0800 (PST) Date: Tue, 3 Nov 2015 06:23:17 -0700 (MST) From: stallapp To: pgsql-jdbc@postgresql.org Message-ID: <1446556997253-5872498.post@n5.nabble.com> Subject: Problem in getting column names from DatabaseMetadata Object MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.3 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Hi, I am using the following code to get the column names of my postgres table but it fails. My database name is "employee" and table name is "employee". Postgres version : 9.3 jdbc driver version : 9.3 public class DBTest { public static void main(String[] args) throws Throwable { Connection conn = getDBConnection(); DatabaseMetaData metaData = conn.getMetaData(); ResultSet resultSet = metaData.getColumns(null, "employee", "employee", null); if (!resultSet.next()) System.out.println("No result set Entries!!"); while (resultSet.next()) { System.out.println(resultSet.getString("COLUMN_NAME")); } conn.close(); } public static Connection getDBConnection() { Connection conn = null; try { Class.forName("org.postgresql.Driver"); conn = DriverManager.getConnection("jdbc:postgresql://sampel.db:5432/data_gen", "postgres", "postgres"); } catch (Throwable th) { th.printStackTrace(); } return conn; } any ideas?? Thanks -- View this message in context: http://postgresql.nabble.com/Problem-in-getting-column-names-from-DatabaseMetadata-Object-tp5872498.html Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com. -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc