IBM DB2 support in Lift

260 views
Skip to first unread message

Moritz Pipahl

unread,
Apr 8, 2011, 8:31:24 AM4/8/11
to Lift
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")
}

Can someone tell me what Im doing wrong?

Derek Chen-Becker

unread,
Apr 8, 2011, 10:16:27 AM4/8/11
to lif...@googlegroups.com, Moritz Pipahl
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


--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.


Derek Chen-Becker

unread,
Apr 23, 2011, 6:08:39 PM4/23/11
to lif...@googlegroups.com
I have a fix branch here:

https://github.com/lift/framework/tree/dcb-issue-965

Could you pull that, build, and see if that resolves the issue? I've also added support directly in Mapper for DB2 based on the DriverType you specified, so you shouldn't have to wire that anymore.

Derek

On Fri, Apr 8, 2011 at 6:31 AM, Moritz Pipahl <moritz...@googlemail.com> wrote:

Derek Chen-Becker

unread,
May 22, 2011, 9:46:57 AM5/22/11
to lif...@googlegroups.com
If anyone has a DB2 instance that they could test this branch against, I would greatly appreciate it.

Thanks,

Derek

Christopher Taylor

unread,
May 23, 2011, 2:05:23 AM5/23/11
to lif...@googlegroups.com
I don't use DB2 myself, but there's a free (beer, obviously) express
version available at
http://www-01.ibm.com/software/data/db2/express/download.html

Regards,
--Chris

On Sun, May 22, 2011 at 3:46 PM, Derek Chen-Becker

Reply all
Reply to author
Forward
0 new messages