Skip to main content

JDBC-ODBC regression in latest builds causing runtime exceptions

1 reply [Last post]
chris_e_brown
Offline
Joined: 2004-09-14

I'm getting some runtime exceptions (not SQLExceptions!) with JDBC-ODBC in the latest builds of Mustang (build 67), where no such problem exists with Java 5.

When working with a Microsoft Access database, attempting to retrieve a date value using ResultSet::getObject() consistently fails for in each test environment I've tried.

Here's the stacktrace:
java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
at java.sql.Timestamp.valueOf(Timestamp.java:208)
at sun.jdbc.odbc.JdbcOdbcResultSet.getTimestamp(JdbcOdbcResultSet.java:1068)
at sun.jdbc.odbc.JdbcOdbcResultSet.getObject(JdbcOdbcResultSet.java:1724)

...and here's the code:

ResultSetMetaData rsmd = rset.getMetaData();
int columnCount = rsmd.getColumnCount();

List columnNames = new ArrayList(columnCount);
List rowData = new ArrayList();

for (int c = 1; c <= columnCount; c++)
{
columnNames.add(rsmd.getColumnName(c));
}

while (rset.next())
{
Object[] fields = new Object[columnCount];
for (int c = 1; c <= columnCount; c++)
{
Object field = rset.getObject(c);
if (field instanceof String)
{
field = DbAccess.clean((String)field);
}
fields[c-1] = field;
}
rowData.add(fields);
}
rset.close();

For information, I only stored dates (not times) in these fields, as Access doesn't seem to differentiate "date" fields from "time" fields. Calling ResultSet::getDate() doesn't cause any problems.

- Chris

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chris_e_brown
Offline
Joined: 2004-09-14

JDBC 4 seems to be causing a quite few regressions for JDBC-ODBC... I just checked, and the following bug still occurs in build 67:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6335589

(variable-length strings retrieved from an access database are padding with null characters...). This is obviously a different issue, but is still causing me problems, so I thought I'd bring it up again (especially as it ties in with the title of my original posting here in this thread).

- Chris