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

JDBC and getTableTypes problem

From: Jim Carroll <jim(at)carroll(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: JDBC and getTableTypes problem
Date: 1998-08-24 02:33:15
Message-ID: Pine.BSD.3.91.980823222400.3115C-100000@apollo.carroll.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
 I am having difficulty try to get the  getTableTypes()  interface  of  JDBC
 functioning correctly with Postgresql 6.3.2. When I try to loop through the
 TABLE_TYPE  attributes, all I can retrieve are 6 copies of the type 'SYSTEM
 INDEX'.

 I am running these versions of software:
 
    Postgresql 6.3.2
 
    JDK 1.1.6.V98-8-14
 
    FreeBSD 2.2.7
 
 Here is the output from my sample program: 

instantiate postgresql.Driver
Connect to database
The following types of tables are available in PostgreSQL: 
  SYSTEM INDEX
  SYSTEM INDEX
  SYSTEM INDEX
  SYSTEM INDEX
  SYSTEM INDEX
  SYSTEM INDEX

 
 Here is the program that generated this output:

import java.sql.*;

public class TableTypes {

   public static void main(String args[]) {

        String url = "jdbc:postgresql:mysql";
        Connection con;

        try {
            System.out.println("instantiate postgresql.Driver");
            Class.forName("postgresql.Driver");
            }
        catch(java.lang.ClassNotFoundException e) {
            System.err.print("ClassNotFoundException: ");
            System.err.println(e.getMessage());
            return;
            }

        try {
            System.out.println("Connect to database");
            con = DriverManager.getConnection(url,"","");

            DatabaseMetaData dbmd = con.getMetaData();
            String dbmsName = dbmd.getDatabaseProductName();
            ResultSet rs = dbmd.getTableTypes();
            System.out.print("The following types of tables are ");
            System.out.println("available in " + dbmsName + ": ");

            while(rs.next()) {
                String tableType = rs.getString("TABLE_TYPE");
                System.out.println("  " + tableType);
                }

            rs.close();
            con.close();
            }
         catch(SQLException ex) {
            System.err.println("SQLException: " + ex.getMessage());
            }
        }
   }
 
 
 Any insight you can offer would be greatly appreciated.  If someone has the
 time, maybe you could try this example on your system, and see if you get
 the same result.
 
 Thanks.
 
---
Jim C., President       | C A R R O L L - N E T, Inc.
201-488-1332            | New Jersey's Premier Internet Service Provider
www.carroll.com         | 
                        | Want to make your business more competitive, and
                        | at the same time, decrease costs?  Ask about the 
www.message-server.com  | Carroll-Net  Message Server.


Responses

pgsql-interfaces by date

Next:From: Stephen J LombardoDate: 1998-08-24 07:05:17
Subject: Re: [INTERFACES] Perl, Postgres, Web !!!
Previous:From: Bruce MomjianDate: 1998-08-24 01:21:56
Subject: Re: [HACKERS] Convert PGconn, PGresult to opaque types?

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