"Weaver, Scott" <[EMAIL PROTECTED]> writes:

> I ran "ant init" and voila! I had a Turbine system running on DB2/400.
> We'll kind of.  I was able to log in fine using turbine/turbine but
> everytime I tried to create a new user I would get an "SQL Exception: type
> mismatch."  After a little digging, I came upon some one discussing DB2/400
> and VARBINARY fields in JDBC.  From what I gathered, to create a VARBINARY
> in DB2/400, you do not use a BLOB (which I have determined was causing by
> type mismatch error) you use a "VARCHAR FOR BIT DATA" defined like so in
> db.props:
> 
> VARBINARY = VARCHAR (32000) FOR BIT DATA
> 
> After re-running "ant init" everythings humming along fine.

Thanks Scott.  I made a note of this jakarta-turbine-torque's db.props
file for DB2.

> One more thing.  I was having problems with the Village API seeing all my
> columns in my tables as "read-only" which will cause inserts/updates in
> village to fail.  This is due to a possible bug in the
> AS400ResultSetMetaData.isReadonly() method which seems to always return
> true.  To fix this I altered the source code for
> com.workingdogs.village.Column.populate() like so:

Here's Scott's change as a patch.  Scott, what version of the DB2/400
driver does this affect?

Index: Column.java
===================================================================
RCS file: /home/cvspublic/village/com/workingdogs/village/Column.java,v
retrieving revision 1.8
diff -u -u -r1.8 Column.java
--- Column.java 2001/09/10 20:35:32     1.8
+++ Column.java 2001/09/22 17:50:03
@@ -148,7 +148,18 @@
         this.columnType = rsmd.getColumnType (columnNumber);
         this.nullAllowed = rsmd.isNullable(columnNumber) == 1;
         this.autoIncrement = rsmd.isAutoIncrement(columnNumber);
-        this.readOnly = rsmd.isReadOnly (columnNumber);
+        if ("com.ibm.as400.access.AS400JDBCResultSetMetaData"
+            .equals(rsmd.getClass().getName()))
+        {
+            // Hack to work around a bug in the
+            // AS400ResultSetMetaData.isReadonly() method (which
+            // always returns true).
+            this.readOnly = false;
+        }
+        else
+        {
+            this.readOnly = rsmd.isReadOnly (columnNumber);
+        }
         this.searchable = rsmd.isSearchable (columnNumber);
         this.scale = rsmd.getScale (columnNumber);
         this.precision = rsmd.getPrecision (columnNumber);

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to