Menu

#30 Incorrect variables size in DB2

closed
5
2006-10-20
2006-07-29
Andrei
No

The SchemaSpy v.3.0.0 displays the following variables
size for the DB2 v.8.2:
smallint[5],
integer[10],
bigint[19],
time[8].

The true values are
smallint[2],
integer[4],
bigint[8],
time[3].

Discussion

  • John Currier

    John Currier - 2006-08-01

    Logged In: YES
    user_id=1264584

    I'm using JDBC's DatabaseMetaData.getColumns() to extract
    that information. I'm using the returned COLUMN_SIZE for
    that field (documented here:
    http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html#getColumns\(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)
    )

    According to some of the docs that I've read it looks like
    COLUMN_SIZE returns the number of characters required to
    display some data types and not their internal sizes. E.g.
    a short (smallint) is 2 bytes, but requires 5 characters to
    be displayed.

    It's theoretically possible that DB2 returns something
    meaningful in BUFFER_LENGTH, but the docs claim that it's
    not used.

    John

     
  • Andrei

    Andrei - 2006-08-01

    Logged In: YES
    user_id=1560726

    Oh, I see. Maybe it would be useful to make a footnote
    describing what the column actually means -- "size" is a bit
    ambiguous in this case.

    Andrei

     
  • John Currier

    John Currier - 2006-08-01

    Logged In: YES
    user_id=1264584

    DB2's BUFFER_LENGTH *might* provide something more
    useful...I'll have to experiment with it.

     
  • John Currier

    John Currier - 2006-08-29

    Logged In: YES
    user_id=1264584

    Andrei, try the attached jar and let me know if it gives the
    expected results. It tries to pull from BUFFER_LENGTH first
    and uses it if it has a non-null value greater than 0.

    Let me know as I don't have DB2,
    John

     
  • John Currier

    John Currier - 2006-08-29

    Pull from BUFFER_LENGTH

     
  • John Currier

    John Currier - 2006-10-05

    Logged In: YES
    user_id=1264584

    This should be fixed in 3.1.0. Let me know if it isn't.

    John

     
  • John Currier

    John Currier - 2006-10-05
    • status: open --> pending
     
  • SourceForge Robot

    • status: pending --> closed
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.

Auth0 Logo