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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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
Logged In: YES
user_id=1264584
DB2's BUFFER_LENGTH *might* provide something more
useful...I'll have to experiment with it.
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
Pull from BUFFER_LENGTH
Logged In: YES
user_id=1264584
This should be fixed in 3.1.0. Let me know if it isn't.
John
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).