java.sql.SQLException: Invalid column type: getLong not implemented for class oracle.jdbc.driver.T4C

2,198 views
Skip to first unread message

Srini Kamisetty

unread,
Sep 14, 2015, 3:34:44 PM9/14/15
to ScalikeJDBC Users Group
Hello,

I am new ScalikeJDBC  and using it with Oracle.  It is awesome library and been easy to use so far.  But, recently I ran into little bump. It is working great with all select statements, but with inserts I am not getting any id back and throws error.  Is there a way to get inserted record's id back, so I can get the record from DB and display on screen.

I get the following error Execution exception[[SQLException: Invalid column type: getLong not implemented for class oracle.jdbc.driver.T4CRowidAccessor]].  I looked at 

here is the methos that actaully does insert.

 def createContract(contract: Contract):= {

        repo.nfidb.autoCommit { implicit session =>
            val id = sql"insert into contracts (name, location) values ('David', 'Miami').updateAndReturnGeneratedKey().apply()
           
       
    }
}


The following is how, I initialize DB

    if (!ConnectionPool.isInitialized('db)) {
        Class.forName(inject[String]("db.jdbc.driver")).newInstance
        ConnectionPool.singleton(
            inject[String]("db.jdbc.url"),
            inject[String]("db.jdbc.user"),
            inject[String]("db.jdbc.pswd"))

        ConnectionPool.add(
            'db,
            inject[String]("db.jdbc.url"),
            inject[String]("db.jdbc.user"),
            inject[String]("db.jdbc.pswd"))

    }

    def db = NamedDB('db)

Thanks for help.

Srini

Kazuhiro Sera

unread,
Sep 14, 2015, 7:55:38 PM9/14/15
to Srini Kamisetty, ScalikeJDBC Users Group
See this pull request for details.

https://github.com/scalikejdbc/scalikejdbc/pull/348

Setting ConnectionPoolSettings#driverName should work for you.

-Kaz
> --
> You received this message because you are subscribed to the Google Groups
> "ScalikeJDBC Users Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scalikejdbc-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages