Error using JDBC2 postgres driver and DatabaseMetaData.getTables()

From: "Andrew Lee" <alee585(at)hotmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Error using JDBC2 postgres driver and DatabaseMetaData.getTables()
Date: 2002-08-19 05:15:42
Message-ID: F10830Dt6vYvdZZZSJh00003d54@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)hotmail(dot)com
Software Engineer
Bensoft, Inc

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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Shahbaz A Chaudhary 2002-08-19 09:12:29 precompiled jdbc with DataSource...why not?
Previous Message Kaarle Kaila 2002-08-17 17:52:02 Re: Updateable ResultSet