From: Caleb D. <dr...@cs...> - 2005-02-22 19:10:18
|
First of thanks to whomever did the Java port, I believe it was Calvin Smith. I need to read data from an mdb file on a Linux system via a Java servlet, and this project (almost) allowed me to do that. I first used the libmdb package ala mdb_export, but I found the test code that does DriverManager.getConnection("jdbc:mdbtools:" + filename), which worked well. Even though very little of the java.sql interfaces are implemented, we have Statement.executeQuery and ResultSet.getString, which are sufficient for my purposes. Thanks again! Other posts indicate that the Java port is a bit out-of-date, so perhaps the memo bug I describe below has been fixed in the C version. From the libmdb code, it looks like some manual intervention is required to turn the C into Java, so perhaps this is why. I am not part of the mdbtools team and have not participated in any such project, so I will describe two bugs I found and apologize for not fixing them. 1) Java bug (crucial, but trivial): in DataResultSet.getString(String), the method loops through the column names to get the index to call DataResultSet.getString(int), which does the real work. DataResultSet.getString(int) correctly accounts for the fact that ResultSet.getXXX(int) method number the columns from 1, as does SQL. However, DataResultSet.getString(String) does not account for the offset. Line 168 "return getString(i);" in the for loop should be return "getString(i + 1);". (I'm not sure what the plans are for the Java wrappers, but obviously a table from column names to indices in DataResultSet would be better.) 2) I'm getting various index out of bounds errors from mdbtools.libmdb.Data.mdb_memo_to_string that are preventing me from reading tables that have a column of type "memo". I can't even query the other columns because the current implementation reads the entire tale into memory, no matter what columns are in the query (right?). I'm getting negative values for the string length and a value > 4096 for row_start, which is used as an index into MdbHandle.page_buf. |