#359 DB2 error when adding table to graph

Snapshot
closed-fixed
5
2015-01-08
2006-03-16
eagle79
No

Adding some tables to a graph does nothing, and the
following is added to the logs. It appears that this
only happens on tables which have FK references to
another table, but I'm not sure about that.

I can send schema information on a table that causes
this, but I'd prefer to do it over email. Just let me know.

Stackrace follows:
9573958 [AWT-EventQueue-1] ERROR
net.sourceforge.squirrel_sql.client.Application -
Exception occured dispatching Event
java.awt.event.MouseEvent[MOUSE_RELEASED,(207,621),button=1,modifiers=Button1,clickCount=1]
on frame0
java.lang.RuntimeException:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver]
CLI0109E String data right truncation. SQLSTATE=22001
at
net.sourceforge.squirrel_sql.plugins.graph.TableFrameController.<init>(TableFrameController.java:199)
at
net.sourceforge.squirrel_sql.plugins.graph.GraphController.addTableIntern(GraphController.java:225)
at
net.sourceforge.squirrel_sql.plugins.graph.GraphController.addTable(GraphController.java:213)
at
net.sourceforge.squirrel_sql.plugins.graph.AddToGraphAction.actionPerformed(AddToGraphAction.java:75)
at
javax.swing.AbstractButton.fireActionPerformed(Unknown
Source)
at
javax.swing.AbstractButton$Handler.actionPerformed(Unknown
Source)
at
javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown
Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at
javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown
Source)
at
javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown
Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown
Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Unknown
Source)
at
java.awt.LightweightDispatcher.processMouseEvent(Unknown
Source)
at
java.awt.LightweightDispatcher.dispatchEvent(Unknown
Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at
net.sourceforge.squirrel_sql.client.Application$1.dispatchEvent(Application.java:172)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI
Driver] CLI0109E String data right truncation.
SQLSTATE=22001
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:275)
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:212)
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:463)
at
COM.ibm.db2.jdbc.app.DB2ResultSet.next(DB2ResultSet.java:562)
at
net.sourceforge.squirrel_sql.plugins.graph.TableFrameController.initFromDB(TableFrameController.java:249)
at
net.sourceforge.squirrel_sql.plugins.graph.TableFrameController.<init>(TableFrameController.java:102)
... 31 more

Discussion

  • eagle79

    eagle79 - 2006-03-22

    Logged In: YES
    user_id=1300245

    UPDATE (FYI) Problem also exists in 2.2 RC1

     
  • Rob Manning

    Rob Manning - 2006-03-22

    Logged In: YES
    user_id=1287991

    Gosh, it's not really clear how to fix this. It really looks
    like a bug in the jdbc driver. The code is:

    res = metaData.getImportedKeys(_catalog, _schema, _tableName);
    while (res.next()) {
    ...
    }

    and it's res.next() that throws the SQLException.
    It looks like the driver made it past the calls:

    res = metaData.getColumns(_catalog, _schema, _tableName, null);
    res = metaData.getPrimaryKeys(_catalog, _schema, _tableName);

    to get to this place in the code where it decided that now
    it doesn't like this call to DatabaseMetaData :

    res = metaData.getImportedKeys(_catalog, _schema, _tableName);

    So, it's a real head-scratcher. About the best thing we
    could do is to wrap these calls in try/catch blocks so that
    the graph is still created albeit without the constraint
    information.

    Gerd, if you think this is a good way to handle this, I
    can make the change.

    Rob

     
  • eagle79

    eagle79 - 2006-03-23

    Logged In: YES
    user_id=1300245

    Hmmm... what you said makes me think of something... Our
    crappy old drivers are not fully JDBC compliant... at least
    not with one version or another... I'll try to dig up the
    details on that and post what I find here...

     
  • eagle79

    eagle79 - 2006-03-23

    Logged In: YES
    user_id=1300245

    Okay... yes, it would appear to be driver-related. Hibernate
    prints out a bit of information about our driver in one of
    our applications, and here are a few lines that are telling:

    [3/22/06 21:15:41:259 EST] 00000019 WSRdbDataSour I
    DSRA8203I: Database product name : DB2
    [3/22/06 21:15:41:274 EST] 00000019 WSRdbDataSour I
    DSRA8204I: Database product version : 07.01.0001
    [3/22/06 21:15:41:977 EST] 00000019 WSRdbDataSour I
    DSRA8205I: JDBC driver name : IBM DB2 JDBC 2.0 Type 2
    [3/22/06 21:15:42:009 EST] 00000019 WSRdbDataSour I
    DSRA8206I: JDBC driver version : 07.02.0007
    [3/22/06 21:15:42:056 EST] 00000019 WSJdbcDatabas W
    DSRA8750W: The JDBC 3.0 method getDatabaseMajorVersion is
    not implemented on this JDBC Provider.
    [3/22/06 21:15:42:056 EST] 00000019 SettingsFacto I RDBMS:
    DB2, version: 07.01.0001
    [3/22/06 21:15:42:102 EST] 00000019 SettingsFacto I JDBC
    driver: IBM DB2 JDBC 2.0 Type 2, version: 07.02.0007
    [3/22/06 21:15:42:102 EST] 00000019 WSJdbcDatabas W
    DSRA8750W: The JDBC 3.0 method supportsGetGeneratedKeys is
    not implemented on this JDBC Provider.

    I guess the solution you posed would be the most useful for
    us, as it would allow us to use the graph (albeit without
    the relationships) until I can get us up on a newer driver
    (I've been fussing to get us on a type 4 driver for months)

     
  • Rob Manning

    Rob Manning - 2006-03-23

    Logged In: YES
    user_id=1287991

    OK, the driver doesn't implement certain API methods and
    throws exceptions for others. Still, SQuirreL could handle
    this a little more gracefully :) We'll get it fixed soon.

    Thank you for all the time you spent investigating and
    providing additional info.

    Rob

     
  • eagle79

    eagle79 - 2006-03-23

    Logged In: YES
    user_id=1300245

    No problem... you've got a really nice product here.
    Anything I can do to help, I'll certainly give it a shot!

     
  • eagle79

    eagle79 - 2006-03-23

    Logged In: YES
    user_id=1300245

    Well, I managed to get a newer driver (and type 4 to boot)
    installed and running, so I decided to retry this. When I
    did, I got the following:

    100423 [AWT-EventQueue-1] ERROR
    net.sourceforge.squirrel_sql.client.Application - Exception
    occured dispatching Event
    java.awt.event.MouseEvent[MOUSE_RELEASED,(46,127),button=1,modifiers=Button1,clickCount=1]
    on ###overrideRedirect###
    java.lang.RuntimeException: com.ibm.db2.jcc.a.SqlException:
    Invalid argument: unknown column name COLUMN_NAME
    at
    net.sourceforge.squirrel_sql.plugins.graph.TableFrameController.<init>(TableFrameController.java:199)
    at
    net.sourceforge.squirrel_sql.plugins.graph.GraphController.addTableIntern(GraphController.java:225)
    at
    net.sourceforge.squirrel_sql.plugins.graph.GraphController.addTable(GraphController.java:213)
    at
    net.sourceforge.squirrel_sql.plugins.graph.AddToGraphAction.actionPerformed(AddToGraphAction.java:75)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown
    Source)
    at
    javax.swing.AbstractButton$Handler.actionPerformed(Unknown
    Source)
    at
    javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
    Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown
    Source)
    at
    javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
    Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at
    java.awt.LightweightDispatcher.retargetMouseEvent(Unknown
    Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown
    Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at
    net.sourceforge.squirrel_sql.client.Application$1.dispatchEvent(Application.java:172)
    at
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
    Source)
    at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
    Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: com.ibm.db2.jcc.a.SqlException: Invalid argument:
    unknown column name COLUMN_NAME
    at com.ibm.db2.jcc.a.n.a(n.java:1270)
    at com.ibm.db2.jcc.a.jf.a(jf.java:1369)
    at com.ibm.db2.jcc.a.jf.getString(jf.java:1232)
    at
    net.sourceforge.squirrel_sql.plugins.graph.TableFrameController.initFromDB(TableFrameController.java:216)
    at
    net.sourceforge.squirrel_sql.plugins.graph.TableFrameController.<init>(TableFrameController.java:102)
    ... 31 more

    This may be related to another problem, which I'll post
    momentarily under another bug. The various table information
    dialogs no longer have column headings at the top... just
    numbers. This includes the headings in the Columns tab.

     
  • Rob Manning

    Rob Manning - 2006-03-23
    • assigned_to: gerdwagner --> manningr
     
  • Rob Manning

    Rob Manning - 2006-03-23

    Logged In: YES
    user_id=1287991

    Yet another head-scratcher? The lines that are
    throwing the SQLException are :

    res = metaData.getColumns(_catalog, _schema,
    _tableName, null);
    while(res.next()) {
    String columnName = res.getString("COLUMN_NAME");

    which yields:

    Caused by: com.ibm.db2.jcc.a.SqlException: Invalid argument:
    unknown column name COLUMN_NAME

    COLUMN_NAME is a pretty basic field without which there is
    not much we can do. This field tells us for each column
    in the table, what the name of the column is. The header
    of each column in the contents table is simply
    the value of this field in the ResultSet. Without access
    to this, there is little we can do except place a
    number there.

    This doesn't seem to be an improvement over the previous
    driver implementation. Just curious, what is the driver
    filename called and what is the driver classname? I use
    DB2 PE on Windows with the DB2 universal driver. I've
    never seen anything remotely like this from the driver
    that ships with DB2 8.1 PE.

    Rob

     
  • eagle79

    eagle79 - 2006-03-24

    Logged In: YES
    user_id=1300245

    Okay,

    I double checked that I was using the right drivers
    (actually, I just pulled down the drivers I was supposed to
    be using from our production app-server). The same problem
    is still there.

    The driver is the DB2 Universal NET driver (aka jcc driver)
    version 2.6.80 (the 8.1 client I believe). It's connecting
    through a DB2 connect gateway (sorry don't know the version)
    to a DB2/390 (aka z/OS) v.7.1 database.

    the filenames of interest are:
    db2jcc.jar
    db2jcc_license_cisuz.jar
    db2jcc_license_cu.jar
    db2policy.jar
    db2jcc_javax.jar

    and the driver classname is
    com.ibm.db2.jcc.DB2Driver

     
  • eagle79

    eagle79 - 2006-03-30

    Logged In: YES
    user_id=1300245

    UPDATE: Tested Snapshot-20060325_1439

    under the JDBC 2.0 (Type 2) drivers, the table now appears
    in the graph cleanly (though without references of course),
    and the DB2 error is put into the log. I think this is about
    as cleanly as this can be handled by SQuirreL

    under the JDBC 3.0 (Type 4) drivers, the table column names
    do not appear as before, and tables cannot be added to the
    graph (of course), with the same exception as before. I
    still don't know why this is happening, but I suspect either
    a driver issue of some sort, or some incompatibility/bug
    between the driver and a DB2/390 database. If I can find
    time to play with this, I'll see if I can find out something
    driver-related. Any clues from anyone are much appreciated,
    though.

    I cannot test the JDBC 3.0 Type 2 drivers, because I don't
    have them installed, nor can I install them at the moment.

     
  • eagle79

    eagle79 - 2006-04-04

    Logged In: YES
    user_id=1300245

    Okay,

    After a LOT of digging, I finally think I've confirmed this
    is driver-related. I haven't yet figured out whether this is
    a database server-level configuration problem or if it's
    because I didn't actually install the type 4 drivers (I just
    got the JARs and started using them), but in either case, it
    certainly isn't SQuirreL and it isn't something that can
    really be defended against programmatically. Basically
    what's happening is that DB2 (or the driver) is returning
    numbers as column names in the meta-data, which of course,
    is useless to SQuirreL, as it would probably be a bad idea
    to hard code resultset locations.

    This problem can be closed, and thanks so much for your help!

     
  • Rob Manning

    Rob Manning - 2006-04-04
    • status: open --> closed-fixed
     
  • Rob Manning

    Rob Manning - 2006-04-04

    Logged In: YES
    user_id=1287991

    You are certainly welcome. Thank you for doing the legwork
    on this one. Not having access to the offending server and
    driver would make it nearly impossible us to troubleshoot ;)
    That's one lousy driver implementation you have there.

    I'm closing this one with "fixed" status since it did
    result in code changes that addressed the initial stack
    trace and allowed you to get around the immediate
    problem with the graph plugin.

    Rob

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks