Thread: DBVisualizer Null Pointer Exception
Howdy, I'm trying to evaluate DbVisualizer but have run into some trouble with the Object Browser. I am using Red Hat 7.2 and the JVM supplied with DbVisualizer (jdk 1.3). I am connecting to a postgres 7.2 database. I am able to get a connection ok and can execute queries with no trouble, I can also view the database info, data types and table types with no problems. However, when I click the references tab to view the fancy object graph, i get the following error: [DEBUG] DB=myserver::mydb Cat=null Sch=null Exception occured during event dispatching: java.lang.NullPointerException at org.postgresql.jdbc2.DatabaseMetaData.getTables(DatabaseMetaData.java:1707) at se.pureit.dbvis.Selector.getTablesFor(Selector.java:679) etc... I've tried switching JDBC drivers (jdbc7.1-1.2.jar, jdbc7.1-1.3.jar, pgjdbc2.jar, and devpgjdbc2.jar) but all produce the Null Pointer. The mailing list archives seem to indicate that people have gotten it working, but nothing saying conclusively that the graphing would work or that it works with my relevant setup. Is there something else that could be causing a problem, or perhaps I need a newer JDBC driver (though I don't think there is one)? Thanks in advance, Robert Treat
Hello Robert, Robert Treat wrote: >[DEBUG] DB=myserver::mydb Cat=null Sch=null >Exception occured during event dispatching: >java.lang.NullPointerException > at > org.postgresql.jdbc2.DatabaseMetaData.getTables(DatabaseMetaData.java:1707) > at se.pureit.dbvis.Selector.getTablesFor(Selector.java:679) > etc... > > Just a blind guess as I run into the same exception with an other program: DatabaseMetaData.getTables() is case-sensitive, but PostgreSQL expects table names as lowercase (if not quoted with "'"). So rename all your tables to lowercase. Best regards, Holger
I wondered about that, but in this case all of my tables are lowercase. Since I've had to clean up mixed case implementations before, I also lowercase everything else as well (functions, views, etc...) I decided to create a test database to see if I could further isolate the problem. I used the following schema in that database: create table people (name char(10), number char(15)); insert into people values ('jenny','8675309'); now I am able to select from the table with no problems, but when I try to use the object browser, I now get this error: java.sql.SQLException: ERROR: no such attribute or function 'oid' at org.postgresql.Connection.ExecSQL(Connection.java:533) On the one hand this seems to imply that DatabaseMetaData.getTables is working ok, but I think that maybe there is a problem with DatabaseMetaData.getColumns? Robert Treat On Thu, 2002-06-27 at 05:42, Holger Mitterwald wrote: > Hello Robert, > > Robert Treat wrote: > > >[DEBUG] DB=myserver::mydb Cat=null Sch=null > >Exception occured during event dispatching: > >java.lang.NullPointerException > > at > > org.postgresql.jdbc2.DatabaseMetaData.getTables(DatabaseMetaData.java:1707) > > at se.pureit.dbvis.Selector.getTablesFor(Selector.java:679) > > etc... > > > > > Just a blind guess as I run into the same exception with an other program: > > DatabaseMetaData.getTables() is case-sensitive, but PostgreSQL expects > table names as lowercase (if not quoted with "'"). > So rename all your tables to lowercase. > > Best regards, > Holger >
This continues the discussion of optimizing the reading of characters from the backend. From what I can tell, PG_Stream.ReceiveChar() is no less efficient (approximately) than PG_Stream.Receive(byte[] b, int off, int length). The later is simply a wrapper around InputStream's method read(b,off,len). My test showed little or no difference between the two methods. We would need to override read(b,off,len) for true improvements. from java.io.InputStream: <snip> The read(b, off, len) method for class InputStream simply calls the method read() repeatedly. If the first such call results in an IOException, that exception is returned from the call to the read(b, off, len) method. If any subsequent call to read() results in a IOException, the exception is caught and treated as if it were end of file; the bytes read up to that point are stored into b and the number of bytes read before the exception occurred is returned. Subclasses are encouraged to provide a more efficient implementation of this method. </snip> I still have to test this over a modem. The high latency may demonstrate the benefits of buffering. Mike
Robert, Did you get this sorted out? Dave On Thu, 2002-06-27 at 10:48, Robert Treat wrote: > I wondered about that, but in this case all of my tables are lowercase. > Since I've had to clean up mixed case implementations before, I also > lowercase everything else as well (functions, views, etc...) > > I decided to create a test database to see if I could further isolate > the problem. I used the following schema in that database: > > create table people (name char(10), number char(15)); > insert into people values ('jenny','8675309'); > > now I am able to select from the table with no problems, but when I try > to use the object browser, I now get this error: > > java.sql.SQLException: ERROR: no such attribute or function 'oid' > at org.postgresql.Connection.ExecSQL(Connection.java:533) > > > On the one hand this seems to imply that DatabaseMetaData.getTables is > working ok, but I think that maybe there is a problem with > DatabaseMetaData.getColumns? > > > Robert Treat > > On Thu, 2002-06-27 at 05:42, Holger Mitterwald wrote: > > Hello Robert, > > > > Robert Treat wrote: > > > > >[DEBUG] DB=myserver::mydb Cat=null Sch=null > > >Exception occured during event dispatching: > > >java.lang.NullPointerException > > > at > > > org.postgresql.jdbc2.DatabaseMetaData.getTables(DatabaseMetaData.java:1707) > > > at se.pureit.dbvis.Selector.getTablesFor(Selector.java:679) > > > etc... > > > > > > > > Just a blind guess as I run into the same exception with an other program: > > > > DatabaseMetaData.getTables() is case-sensitive, but PostgreSQL expects > > table names as lowercase (if not quoted with "'"). > > So rename all your tables to lowercase. > > > > Best regards, > > Holger > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > >
No. I've only dug a little bit more but haven't really turned up anything new. I was going to try a different jdk to see if the interaction was any different, but then had issues with dbvisualizer itself (I think it was a configuration issue). Given that there seems to be some other problems with the DatabaseMetaData functions (see Aslak Hellesoy post from last week) that probably wasn't going in the right direction anyway. Robert Treat On Mon, 2002-07-08 at 08:59, Dave Cramer wrote: > Robert, > > Did you get this sorted out? > > Dave > On Thu, 2002-06-27 at 10:48, Robert Treat wrote: > > I wondered about that, but in this case all of my tables are lowercase. > > Since I've had to clean up mixed case implementations before, I also > > lowercase everything else as well (functions, views, etc...) > > > > I decided to create a test database to see if I could further isolate > > the problem. I used the following schema in that database: > > > > create table people (name char(10), number char(15)); > > insert into people values ('jenny','8675309'); > > > > now I am able to select from the table with no problems, but when I try > > to use the object browser, I now get this error: > > > > java.sql.SQLException: ERROR: no such attribute or function 'oid' > > at org.postgresql.Connection.ExecSQL(Connection.java:533) > > > > > > On the one hand this seems to imply that DatabaseMetaData.getTables is > > working ok, but I think that maybe there is a problem with > > DatabaseMetaData.getColumns? > > > > > > Robert Treat > > > > On Thu, 2002-06-27 at 05:42, Holger Mitterwald wrote: > > > Hello Robert, > > > > > > Robert Treat wrote: > > > > > > >[DEBUG] DB=myserver::mydb Cat=null Sch=null > > > >Exception occured during event dispatching: > > > >java.lang.NullPointerException > > > > at > > > > org.postgresql.jdbc2.DatabaseMetaData.getTables(DatabaseMetaData.java:1707) > > > > at se.pureit.dbvis.Selector.getTablesFor(Selector.java:679) > > > > etc... > > > > > > > > > > > Just a blind guess as I run into the same exception with an other program: > > > > > > DatabaseMetaData.getTables() is case-sensitive, but PostgreSQL expects > > > table names as lowercase (if not quoted with "'"). > > > So rename all your tables to lowercase. > > > > > > Best regards, > > > Holger > > >