Error using JDBC2 postgres driver and DatabaseMetaData.getTables() - Mailing list pgsql-jdbc

From Andrew Lee
Subject Error using JDBC2 postgres driver and DatabaseMetaData.getTables()
Date
Msg-id F10830Dt6vYvdZZZSJh00003d54@hotmail.com
Whole thread Raw
Responses Stored procedures
Re: Error using JDBC2 postgres driver and DatabaseMetaData.getTables()
List pgsql-jdbc
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


pgsql-jdbc by date:

Previous
From: Kaarle Kaila
Date:
Subject: Re: Updateable ResultSet
Next
From: Shahbaz A Chaudhary
Date:
Subject: precompiled jdbc with DataSource...why not?