This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Cannot view tables on DB2 | ||
---|---|---|---|
Product: | db | Reporter: | kovica <kovica> |
Component: | Code | Assignee: | Jiri Rechtacek <jrechtacek> |
Status: | RESOLVED WORKSFORME | ||
Severity: | blocker | ||
Priority: | P4 | ||
Version: | 5.x | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
Database Explorer with improved logging
Fixed Database Explorer with improved logging Database Explorer with logging for the Tables node Test program Test program iterating over all columns |
Description
kovica
2006-05-08 08:08:38 UTC
Which version of DB2 and the driver? Can you also reproduce on JDK 1.5? Please run NetBeans with a clean userdir and using -J-Dorg.netbeans.modules.db=0 on the command line. Reproduce the issue and attach the message log here. DB2 is at vesion 8.2.4, JCC driver(com.ibm.db2.jcc.DB2Driver) I'm trying on JDK 1.5. This is what I get: [org.netbeans.modules.db.explorer.DatabaseConnection] connect() [org.netbeans.modules.db.runtime.DatabaseRuntimeManager] Runtime: org.netbeans.modules.derby.RegisterDerby for driver org.apache.derby.jdbc.ClientDriver [org.netbeans.modules.db.runtime.DatabaseRuntimeManager] Runtime: org.netbeans.modules.j2ee.sun.ide.j2ee.db.RegisterPointbase for driver com.pointbase.jdbc.jdbcUniversalDriver [org.netbeans.modules.db.explorer] Creating DbURLClassLoader for [file:/home/gregor/LIB/DB2/8.2/db2jcc.jar, file:/home/gregor/LIB/DB2/8.2/db2jcc_javax.jar, file:/home/gregor/LIB/DB2/8.2/db2jcc_license_cu.jar] You are trying to access file: DB2JccConfiguration.properties from the default package. Please see http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/classpath.html#default_package I tried to reproduce with DB2 8.2 (version reported by the connection is SQL08020), JCC driver and a TCP/IP connection: jdbc:db2://example.org:50000/sample with both JDK 1.5 and 1.6 b82, but with no luck. Are you using a TCP/IC connection (with a database URL like above) or a local one (with a database URL like "jdbc:db2:sample")? Is the JCC driver version the same that came with your version of DB2? I'm attaching a version of the Database Explorer module which should log the exception. Replace the original JAR in the <netbeans>/ide7/modules directory, reproduce the bug and attach the message log to this issue. Thanks. Created attachment 30364 [details]
Database Explorer with improved logging
I'm using URL as in your example. I copied the JCC driver from the DB2 installation. When I use your attached org-netbeans-modules-db.jar file I get: [org.netbeans.modules.db.explorer.DatabaseConnection] connect() [org.netbeans.modules.db.runtime.DatabaseRuntimeManager] Runtime: org.netbeans.modules.derby.RegisterDerby for driver org.apache.derby.jdbc. ClientDriver [org.netbeans.modules.db.runtime.DatabaseRuntimeManager] Runtime: org.netbeans.modules.j2ee.sun.ide.j2ee.db.RegisterPointbase for driver com .pointbase.jdbc.jdbcUniversalDriver [org.netbeans.modules.db.explorer] Creating DbURLClassLoader for [file:/home/gregor/Download/BLA/1/db2jcc.jar, file:/home/gregor/Download/BL A/1/db2jcc_javax.jar, file:/home/gregor/Download/BLA/1/db2jcc_license_cu.jar] You are trying to access file: DB2JccConfiguration.properties from the default package. Please see http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/classpath.html#default_package INFORMATIONAL *********** Exception occurred ************ at 2:15 PM on May 12, 2006 java.lang.NullPointerException [catch] at org.netbeans.modules.db.explorer.DatabaseNodeChildren$2.run(DatabaseNodeChildren.java:86) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:493) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:926) I am sorry. The module I attached contained some debug code that I had added to check that exceptions are logged property and that I forgot to remove. I'm attaching a new module, please try with it. Thank you for help! Created attachment 30398 [details]
Fixed Database Explorer with improved logging
[org.netbeans.modules.db.explorer.DatabaseConnection] connect() [org.netbeans.modules.db.runtime.DatabaseRuntimeManager] Runtime: org.netbeans.modules.derby.RegisterDerby for driver org.apache.derby.jdbc.ClientDr iver [org.netbeans.modules.db.runtime.DatabaseRuntimeManager] Runtime: org.netbeans.modules.j2ee.sun.ide.j2ee.db.RegisterPointbase for driver com.pointba se.jdbc.jdbcUniversalDriver [org.netbeans.modules.db.explorer] Creating DbURLClassLoader for [file:/home/gregor/Download/BLA/1/db2jcc.jar, file:/home/gregor/Download/BLA/1/db2j cc_javax.jar, file:/home/gregor/Download/BLA/1/db2jcc_license_cu.jar] You are trying to access file: DB2JccConfiguration.properties from the default package. Please see http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/classpath.html#default_package INFORMATIONAL *********** Exception occurred ************ at 2:46 PM on May 15, 2006 org.netbeans.api.db.explorer.DatabaseException at org.netbeans.modules.db.explorer.infos.TableListNodeInfo.initChildren(TableListNodeInfo.java:50) at org.netbeans.modules.db.explorer.infos.DatabaseNodeInfo.getChildren(DatabaseNodeInfo.java:669) [catch] at org.netbeans.modules.db.explorer.DatabaseNodeChildren$2.run(DatabaseNodeChildren.java:87) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:493) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:926) Thanks, that helped a bit. It is probably caused a call to DatabaseMetaData.getTables(). I'm attaching a new version of the module with more logging in that area, please test. Shortly I will also attach a JDBC program to test the getTables() call outside NetBeans. Created attachment 30401 [details]
Database Explorer with logging for the Tables node
Here is the test program. Please fill in the values for the database URL, user, password and schema and run. Let me know if any exceptions are thrown. Please don't forget to try to reproduce the issue with the last db module I attached. Thanks. Created attachment 30404 [details]
Test program
The test program (MainDB2) does list all the tables in the provided schema. When using NB5.5 and the new org-netbeans-modules-db.jar I get: [org.netbeans.modules.db.explorer.DatabaseConnection] connect() [org.netbeans.modules.db.runtime.DatabaseRuntimeManager] Runtime: org.netbeans.modules.derby.RegisterDerby for driver org.apache.derby.jdbc.ClientDr iver [org.netbeans.modules.db.runtime.DatabaseRuntimeManager] Runtime: org.netbeans.modules.j2ee.sun.ide.j2ee.db.RegisterPointbase for driver com.pointba se.jdbc.jdbcUniversalDriver [org.netbeans.modules.db.explorer] Creating DbURLClassLoader for [file:/home/gregor/Download/BLA/1/db2jcc.jar, file:/home/gregor/Download/BLA/1/db2j cc_javax.jar, file:/home/gregor/Download/BLA/1/db2jcc_license_cu.jar] You are trying to access file: DB2JccConfiguration.properties from the default package. Please see http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/classpath.html#default_package INFORMATIONAL *********** Exception occurred ************ at 9:21 AM on May 16, 2006 org.netbeans.api.db.explorer.DatabaseException at org.netbeans.modules.db.explorer.infos.TableListNodeInfo.initChildren(TableListNodeInfo.java:52) at org.netbeans.modules.db.explorer.infos.DatabaseNodeInfo.getChildren(DatabaseNodeInfo.java:669) [catch] at org.netbeans.modules.db.explorer.DatabaseNodeChildren$2.run(DatabaseNodeChildren.java:87) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:493) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:926) Caused by: com.ibm.db2.jcc.b.SqlException at com.ibm.db2.jcc.b.r.a(r.java:1516) at com.ibm.db2.jcc.b.r.m(r.java:465) at com.ibm.db2.jcc.b.r.M(r.java:1100) at com.ibm.db2.jcc.b.ad.getString(ad.java:900) at org.netbeans.lib.ddl.impl.DriverSpecification.getRow(DriverSpecification.java:198) at org.netbeans.modules.db.explorer.infos.TableListNodeInfo.initChildren(TableListNodeInfo.java:40) ... 4 more So the exception is thrown while calling getString() on the ResultSet containing the table list. I modified the test program to call getString() on all columns of the table ResultSet, please run it and attach any exceptions it throws. Created attachment 30421 [details]
Test program iterating over all columns
Exception reading column 5 com.ibm.db2.jcc.a.SqlException at com.ibm.db2.jcc.a.s.a(s.java:1520) at com.ibm.db2.jcc.a.s.m(s.java:465) at com.ibm.db2.jcc.a.s.M(s.java:1102) at com.ibm.db2.jcc.a.jf.getString(jf.java:901) at MainDB2.main(MainDB2.java:29) Column 5 is REMARKS. I've tried this with the APP driver and it does work. I'll try the Connection too. OK, using COM.ibm.db2.jdbc.app.DB2Driver works. What now ? The test program shows this is a bug in the JCC driver, not in NetBeans. On the other hand the Database Explorer should not read the REMARKS column, as it doesn't do anything with the value. Downgrading to P3. I'm not sure I will be able to fix it for 5.5, since the fix could affect a lot of code, so it could be risky. But I will try. In the meanwhile can you use the APP driver instead of the JCC one for connecting from the Database Explorer? Yes, I can. The fix could be to modify DriverSpecification.getRow() to return a live Map delegating to the current ResultSet row. Risky since the Map doesn't have a chance to detect that/if a client advances to another row, so it will retrieve new data from the new row. Could use ResultSet.getRow(), but that isn't guaranteed to be supported by all drivers. Better to fix early in the bug fixing phase. I just searched, and it doesn't look like IBM even supports the JCC driver any more. Given that this would require a big change, and because the JCC driver is being used less and less by our users, I am going to resolve this with LATER. This may also be resolved when we use our new Metadata model. I don't know where you searched, but I think you are wrong. IBM indeed does not support drivers like COM.ibm.db2.jdbc.net.DB2Driver and COM.ibm.db2.jdbc.app.DB2Driver anymore, but JCC is considered Universal driver and it is very much supported. Please look at http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.wn.doc/doc/c0051316.html and http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.wn.doc/doc/c0052012.html. IBM has even added JDBC 4 support in DB2 9.5. Apologies that I missed this. It's possible that this will be fixed because we're changing the way we're getting database metadata. So I'll tentatively mark this as to be fixed in the next release, at this point I can't commit to getting it fixed in this release. Reassigned to new owner. I can connect DB2 in recent NB IDE releases (NB6.7, NB6.8Beta) |