|
|||||||||||
|
JDBC driver not returning correct table meta data
From: sadeepa <sadeepa(at)lk.opro.net>
Date: Mon Aug 06 2007 - 03:02:23 EDT
while accessing MySQL Enterprise Edition (Version : 5.0.36sp1-enterprise-gpl)
using the
One of the tables in our database contains 5 fields with date, time,
datetime, timestamp
We could retrieve the table field information using getColumns() method, on DatabaseMetadata with mysql-connector-java-3.0.11 driver. We wanted the same thing to happen with mysql-connector-java-5.0.7 driver.
However when we executed the same code with mysql-connector-java-5.0.7
driver, it returned
The steps followed and code segments used are as follows:
DatabaseMetaData databaseMetaData; databaseMetaData = conn.getMetaData(); ResultSet rs = databaseMetaData.getColumns(null,null,tableName,"%"); while (rs.next()) { String fieldSize=rs.getString(7); } We could obtain the metadata of other types (varchar / char / etc)
We also used JBuilder's "Database Pilot" tool to check this. It returnd 0 as
the size for
How to repeat:
2. Create a database connection to the MySql Enterprise Edition DB and mysql-connector-java-5.0.7 3. Try to get the database metadata and field sizes using:
DatabaseMetaData databaseMetaData;
String fieldSize=rs.getString(7);
}
When we connected to the same database using mysql-connector-odbc-3.51.16-win32 we were able to receive the expected results. -- -- This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:30:40 EDT |
||||||||||
|
|||||||||||