IBM DB2 not supported #965

Closed
indrajitr opened this Issue Apr 11, 2011 · 7 comments

3 participants

@indrajitr
Lift Web Framework member

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

@dchenbecker
Lift Web Framework member

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.

@dchenbecker
Lift Web Framework member

(In [[r: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

@dchenbecker
Lift Web Framework member
@dchenbecker
Lift Web Framework member

(In [[r:038857775284a618904529b3c3f4959e237c714b]]) Add support for DB2 to Mapper

Closes #965

Also refactored PreparedStatement handling to de-dup code

Branch: master

@dchenbecker
Lift Web Framework member

(In [[r: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

@dchenbecker
Lift Web Framework member

(In [[r: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

@dchenbecker dchenbecker was assigned Mar 1, 2012
@etorreborre etorreborre pushed a commit to etorreborre/framework that referenced this issue Dec 3, 2014
@dchenbecker dchenbecker Add support for DB2 to Mapper
Closes #965

Also refactored PreparedStatement handling to de-dup code
0388577
@etorreborre etorreborre pushed a commit to etorreborre/framework that referenced this issue Dec 3, 2014
@dchenbecker dchenbecker 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
1a57d8e
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment