DatabaseMetaData.getTablePrivileges()

From: danap(at)itstriangle(dot)com
To: pgsql-jdbc(at)postgresql(dot)org
Subject: DatabaseMetaData.getTablePrivileges()
Date: 2010-10-08 00:50:19
Message-ID: 77ea1411cd9895f924e706b418d03702.squirrel@www.webmail.itstriangle.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Today I update the one of the development systems for the MyJSQLView
project to
test the PostgreSQL 9.0 database. Once the database was installed and also
the
latest JDBC 9.0-801 I tested the program. The application crashed and
after some
testing I attributed the exception to the empty string "" parameter for the
schemaPattern argument in DatabaseMetaData.getTablePrivileges() for the JDBC.
Well not sure the JDBC is really causing the problem, it is throwing the
exception,
but the error disappears when the same JDBC is used with the PostgreSQL 8.4.4
database. The Java API since I'm pretty sure 1.4 clearly indicates the empty
string "" is valid for the schemaPattern parameter.

"
Parameters:
schemaPattern - a schema name pattern; must match the schema name as it is
stored
in the database; "" retrieves those without a schema; null means that the
schema
name should not be used to narrow the search
"

Particulars, Exception, and Abbreviated Code attached.
Source for the code, MyJSQLView_Access,
http://code.google.com/p/myjsqlview/source/browse/

danap.

--------------------------------------------------------
Linux Platform
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
postgresql-9.0-801.jdbc3.jar & postgresql-9.0.801.jdbc4.jar

SQL version: PostgreSQL 8.4.4 (Works Fine)

SQL version: PostgreSQL 9.0.1 (Crashes)

Exception in thread "AWT-EventQueue-0"
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at
org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.addACLPrivileges(AbstractJdbc2DatabaseMetaData.java:2799)
at
org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.parseACL(AbstractJdbc2DatabaseMetaData.java:2878)
at
org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getTablePrivileges(AbstractJdbc2DatabaseMetaData.java:2700)
at
com.dandymadeproductions.myjsqlview.MyJSQLView_Access.loadDBTables(MyJSQLView_Access.java:1559)
at
com.dandymadeproductions.myjsqlview.MyJSQLView_Access.accessCheck(MyJSQLView_Access.java:1200)
at
com.dandymadeproductions.myjsqlview.MyJSQLView_Access.actionPerformed(MyJSQLView_Access.java:628)
----------------------------------------------------------

Attachment Content-Type Size
dbTables.txt text/plain 1.2 KB

Browse pgsql-jdbc by date

  From Date Subject
Next Message danap 2010-10-08 01:16:53 DatabaseMetaData.getTablePrivileges()
Previous Message guanyi 2010-10-07 07:30:28 jdbc pool problem