pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Lee <alee585@hotmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Error using JDBC2 postgres driver and DatabaseMetaData.getTables()
Date: Mon, 19 Aug 2002 05:15:42 +0000
Message-ID: <F10830Dt6vYvdZZZSJh00003d54@hotmail.com> (raw)

I am attempting to use an Object Relational Code Generation
engine (cartographer, http://cartographer.sourceforge.com)
with a database that I have in Postgresql 7.2 running under
RedHat Linux 7.3 and JDK 1.4.0_01.

The error I am encountering, and the stack trace are:

//----- Begin Error Message -----//

java.sql.SQLException: ERROR: parser: parse error at or near ")"
   at org.postgresql.core.QueryExecutor.execute(Unknown Source)
   at org.postgresql.Connection.ExecSQL(Unknown Source)
   at org.postgresql.Connection.ExecSQL(Unknown Source)
   at org.postgresql.jdbc2.DatabaseMetaData.getTables(Unknown Source)
   at cartographer.Mapper.mapDatasource(Mapper.java:133)
   at cartographer.Cartographer.main(Cartographer.java:109)

//----- End Error Message -----//

The offending piece of code in the Mapper object follows:

//----- Begin Code Block -----//

private Properties props;

public Mapper(Properties props)
{
  this.props = props;
}

/**
*
*/
public Vector mapDatasource()
{
  Connection con = null;
  ResultSet rs = null;

  String [] tableTypes = { "Table" };
  Vector tableNameVector = new Vector();
  try
  {
    log("Connecting to datasource: " + props.getProperty("url"));
    ConnectionManager cm =
      new ConnectionManager(props.getProperty("driver"),
                            props.getProperty("url"),
                            props.getProperty("user"),
                            props.getProperty("pass")
			   );
    con = cm.getConnection();
    DatabaseMetaData dbmd = con.getMetaData();

    log("Database: " + dbmd.getDatabaseProductName());
    log("Database Version: " + dbmd.getDatabaseProductVersion());
    log("Driver: " + dbmd.getDriverName());
    log("Driver Version: " + dbmd.getDriverVersion());
    log("\n");

    rs = dbmd.getTables(null,null,null,tableTypes);
    //rs = dbmd.getTables(null,null,null,null);

    while( rs.next() )
    {
      tableNameVector.addElement(rs.getString(3));
    }
    rs.close();
    con.close();
  }
  catch(SQLException sqle)
  {
    sqle.printStackTrace();
  }
  catch(Exception e)
  {
    e.printStackTrace();
  }
  return tableNameVector;
}
//----- End Code Block -----//

The stack trace points to line 133 which is:
    rs = dbmd.getTables(null,null,null,tableTypes);

I have also tried:
    rs = dbmd.getTables(null,null,null,null);

Both of these methods yield the same error message.

I have used this program with other databases and drivers
without a problem (e.g. MySql and MS SQL Server 2000).

Can anyone see where the problem might be? Or what course of
action I could take to fix this problem?

Thanks,
Andrew Lee
alee585@hotmail.com
Software Engineer
Bensoft, Inc




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx




view thread (3+ messages)  latest in thread

Message-ID: <F10830Dt6vYvdZZZSJh00003d54@hotmail.com>
Permalink:  ../F10830Dt6vYvdZZZSJh00003d54@hotmail.com/
Also on:    postgresql.org/message-id/F10830Dt6vYvdZZZSJh00003d54@hotmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: alee585@hotmail.com
  Subject: Re: Error using JDBC2 postgres driver and DatabaseMetaData.getTables()
  In-Reply-To: <F10830Dt6vYvdZZZSJh00003d54@hotmail.com>
  References: <F10830Dt6vYvdZZZSJh00003d54@hotmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox