In Connector J / DatabaseMetaData::getColumns() throws an exceptionwhen asking for the 7th column (C

In Connector J / DatabaseMetaData::getColumns() throws an exceptionwhen asking for the 7th column (C

am 20.09.2002 08:51:57 von Ocke Janssen

Description:

When using the new beta 3.0.0.0 driver with OpenOffice, I
encountered a problem while accessing the 7th column
(COLUMN_SIZE) of DatabaseMetaData::getColumns.
The problem araise when the table contains a longblob column.
I've had a look at the source code and found that the size value for
longblob type can be greater than Integer.MAX_VALUE which is
checked in the ResultSet when calling getInt(7) and for that
reason I get an Exception when asking for it.

How-To-Repeat:
Create a table with a long blob column. Query for the columns
through DatabaseMetaData::getColumns, ask for the columnSize
column (7th column). -> An exception is thrown.

Fix:
When comparing to this value all works right.
size = ( MysqlIO.getMaxBuf() < Integer.MAX_VALUE ) ?
Integer.toString(MysqlIO.getMaxBuf()) :
Integer.toString(Integer.MAX_VALUE );

Best regards,

Ocke








------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12565@lists.mysql.com
To unsubscribe, e-mail