IBM DB2 not supported
Im trying to get lift to work with DB2 for two days now, but I still havent figured it out. I use com.ibm.db2.jcc.DB2Driver and can connect to a database now (user table is created), but whenever I try to register a new user (causing the app to write into the database) I get an exception:
com.ibm.db2.jcc.c.SqlException: [ibm][db2][jcc][10271][10296] unrecognized JDBC-Type: 16.
I use the following DriverType:
object DB2DriverType extends DriverType("DB2/NT")
{
def binaryColumnType = "LONG VARCHAR FOR BIT DATA"
def booleanColumnType = "SMALLINT"
def clobColumnType = "LONG VARCHAR"
def dateTimeColumnType = "TIMESTAMP"
def dateColumnType = "DATE"
def timeColumnType = "TIME"
def integerColumnType = "INT"
def integerIndexColumnType = "INTEGER NOT NULL GENERATED BY DEFAULT AS IDENITY"
def enumColumnType = "INT"
def longForeignKeyColumnType = "INT"
def longIndexColumnType = "INT NOT NULL GENERATED BY DEFAULT AS IDENTITY"
def enumListColumnType = "INT"
def longColumnType = "INT"
def doubleColumnType = "DOUBLE"
override def brokenLimit_? : Boolean = true
override def pkDefinedByIndexColumn_? = true
override def defaultSchemaName : Box[String] = Full("DB2ADMIN")
}
Derek Chen-Becker wrote on the mailing list:
This is the DB2 JDBC driver not honoring a Boolean value when using setObject. You can see here that 16 is the value of java.sql.Types.BOOLEAN:
http://download.oracle.com/javase/6/docs/api/constant-values.html#java.sql.Types.BOOLEAN
And this IBM document states that DB2 doesn't have direct support for Boolean or Byte types:
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.java.doc/doc/rjvjdata.htm
This will require a small change to Mapper code to get it working. Please open a ticket.
Derek
com.ibm.db2.jcc.c.SqlException: [ibm][db2][jcc][10271][10296] unrecognized JDBC-Type: 16.
I use the following DriverType:
object DB2DriverType extends DriverType("DB2/NT")
{
def binaryColumnType = "LONG VARCHAR FOR BIT DATA"
def booleanColumnType = "SMALLINT"
def clobColumnType = "LONG VARCHAR"
def dateTimeColumnType = "TIMESTAMP"
def dateColumnType = "DATE"
def timeColumnType = "TIME"
def integerColumnType = "INT"
def integerIndexColumnType = "INTEGER NOT NULL GENERATED BY DEFAULT AS IDENITY"
def enumColumnType = "INT"
def longForeignKeyColumnType = "INT"
def longIndexColumnType = "INT NOT NULL GENERATED BY DEFAULT AS IDENTITY"
def enumListColumnType = "INT"
def longColumnType = "INT"
def doubleColumnType = "DOUBLE"
override def brokenLimit_? : Boolean = true
override def pkDefinedByIndexColumn_? = true
override def defaultSchemaName : Box[String] = Full("DB2ADMIN")
}
Derek Chen-Becker wrote on the mailing list:
This is the DB2 JDBC driver not honoring a Boolean value when using setObject. You can see here that 16 is the value of java.sql.Types.BOOLEAN:
http://download.oracle.com/javase/6/docs/api/constant-values.html#java.sql.Types.BOOLEAN
And this IBM document states that DB2 doesn't have direct support for Boolean or Byte types:
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.java.doc/doc/rjvjdata.htm
This will require a small change to Mapper code to get it working. Please open a ticket.
Derek
Leave a comment
on 2011-04-20 18:38 *
By dchenbecker
Status changed from New to Accepted
Work remaining changed from 0.0 to 1.0
OK, I'm going to need a full stack trace to see where this is occurring. There are several places where we use setObject but most of them are in PK or other places where I wouldn't think you would use a boolean.
on 2011-04-23 21:18 *
By dchenbecker
(In revision:0e3669450f44ff296752c4960690b830036e4acb) Clean up PreparedStatement handling for DB2
Refs #965
Refactored MetaMapper to de-duplicate code for setting
prepared statement values. Will work with reporter to
test against DB2.
Branch: dcb-issue-965
Refs #965
Refactored MetaMapper to de-duplicate code for setting
prepared statement values. Will work with reporter to
test against DB2.
Branch: dcb-issue-965
on 2011-05-27 15:02 *
By dchenbecker
Status changed from Accepted to Test
Work remaining changed from 1.0 to 0.0
(In revision:038857775284a618904529b3c3f4959e237c714b) Add support for DB2 to Mapper
Closes #965
Also refactored PreparedStatement handling to de-dup code
Branch: master
Closes #965
Also refactored PreparedStatement handling to de-dup code
Branch: master
on 2011-05-31 20:45 *
By dchenbecker
(In revision:22f69d7f5d06d54c61b338cb0252719f79fa3e3a) Fix for a bug introduced by #965 (DB2 support)
Refs #965
Missed two calls to convertToJDBCFriendly when refactoring. This
caused JDBC drivers to throw exceptions or otherwise fail
when doing "By" queries against certain Mapper fields. In addition
to fixing the issue, I've added a small bit to the MapperSpec to
detect the condition using MappedEnum
Branch: dcb-fix-mapper-965
Refs #965
Missed two calls to convertToJDBCFriendly when refactoring. This
caused JDBC drivers to throw exceptions or otherwise fail
when doing "By" queries against certain Mapper fields. In addition
to fixing the issue, I've added a small bit to the MapperSpec to
detect the condition using MappedEnum
Branch: dcb-fix-mapper-965
on 2011-06-01 13:43 *
By dchenbecker
(In revision:1a57d8e14f4649b2e60933efb72c2ccd3bfaf184) Fix for a bug introduced by #965 (DB2 support)
Refs #965
Missed two calls to convertToJDBCFriendly when refactoring. This
caused JDBC drivers to throw exceptions or otherwise fail
when doing "By" queries against certain Mapper fields. In addition
to fixing the issue, I've added a small bit to the MapperSpec to
detect the condition using MappedEnum
Branch: master
Refs #965
Missed two calls to convertToJDBCFriendly when refactoring. This
caused JDBC drivers to throw exceptions or otherwise fail
when doing "By" queries against certain Mapper fields. In addition
to fixing the issue, I've added a small bit to the MapperSpec to
detect the condition using MappedEnum
Branch: master