Bug 76061 - Cannot view tables on DB2
Cannot view tables on DB2
Status: RESOLVED WORKSFORME
Product: db
Classification: Unclassified
Component: Code
5.x
PC Linux
: P4 (vote)
: 6.x
Assigned To: Jiri Rechtacek
issues@db
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-08 08:08 UTC by kovica
Modified: 2009-09-17 11:05 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
Database Explorer with improved logging (995.88 KB, application/octet-stream)
2006-05-12 12:30 UTC, Andrei Badea
Details
Fixed Database Explorer with improved logging (995.80 KB, application/octet-stream)
2006-05-15 13:39 UTC, Andrei Badea
Details
Database Explorer with logging for the Tables node (995.88 KB, application/octet-stream)
2006-05-15 15:30 UTC, Andrei Badea
Details
Test program (966 bytes, text/plain)
2006-05-15 17:06 UTC, Andrei Badea
Details
Test program iterating over all columns (1.47 KB, text/plain)
2006-05-16 16:45 UTC, Andrei Badea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kovica 2006-05-08 08:08:38 UTC
I'm using NetBeans 5.5 Dev (Build 200605050500) on Linux with java 1.6.0-beta2-b82.

On the Runtime tab I add DB2 driver (COM.ibm.db2.jdbc.net.DB2Driver or
com.ibm.db2.jcc.DB2Driver). Then I add connection using that driver. I can
connect to the database and the default schema is selected, but when I try to
open Tables node under the connection I get: "Unable to read database structure;
connection is broken; null"
Comment 1 Andrei Badea 2006-05-11 16:02:53 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. 
Comment 2 kovica 2006-05-11 16:35:34 UTC
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
Comment 3 Andrei Badea 2006-05-12 12:29:51 UTC
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.
Comment 4 Andrei Badea 2006-05-12 12:30:44 UTC
Created attachment 30364 [details]
Database Explorer with improved logging
Comment 5 kovica 2006-05-12 13:18:15 UTC
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)
Comment 6 Andrei Badea 2006-05-15 13:38:34 UTC
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!
Comment 7 Andrei Badea 2006-05-15 13:39:37 UTC
Created attachment 30398 [details]
Fixed Database Explorer with improved logging
Comment 8 kovica 2006-05-15 13:47:41 UTC
[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)
Comment 9 Andrei Badea 2006-05-15 15:29:27 UTC
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.
Comment 10 Andrei Badea 2006-05-15 15:30:20 UTC
Created attachment 30401 [details]
Database Explorer with logging for the Tables node
Comment 11 Andrei Badea 2006-05-15 17:06:22 UTC
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.
Comment 12 Andrei Badea 2006-05-15 17:06:54 UTC
Created attachment 30404 [details]
Test program
Comment 13 kovica 2006-05-16 08:22:19 UTC
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
Comment 14 Andrei Badea 2006-05-16 16:44:29 UTC
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.
Comment 15 Andrei Badea 2006-05-16 16:45:26 UTC
Created attachment 30421 [details]
Test program iterating over all columns
Comment 16 kovica 2006-05-16 17:45:15 UTC
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.
Comment 17 kovica 2006-05-16 17:53:53 UTC
OK, using COM.ibm.db2.jdbc.app.DB2Driver works.
What now ?
Comment 18 Andrei Badea 2006-05-17 14:14:22 UTC
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?
Comment 19 kovica 2006-05-17 16:39:48 UTC
Yes, I can.
Comment 20 Andrei Badea 2007-02-14 12:08:37 UTC
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.
Comment 21 David Vancouvering 2008-11-12 17:40:03 UTC
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.
Comment 22 kovica 2008-11-13 06:36:54 UTC
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.
Comment 23 David Vancouvering 2008-11-13 17:32:03 UTC
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.
Comment 24 Jiri Rechtacek 2009-02-10 15:28:36 UTC
Reassigned to new owner.
Comment 25 Jiri Rechtacek 2009-09-17 11:05:13 UTC
I can connect DB2 in recent NB IDE releases (NB6.7, NB6.8Beta)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo