Play Slick with Oracle



Piotr Limanowski

A señor code arsonist based in Gdansk, PL. Been doing scalable web products, with variety of languages (see above for the most recent), since early 2000s. Constatly working on simplyfing things. I write, talk and ship code. Aside from that I'm el modo evil brujito and a future hoverboard owner.


Play Slick with Oracle

Posted by Piotr Limanowski on .

Working with Oracle database never is a pleasure. Right on from the environment setup till the very first CRUD operations. Yet often times we're forced to do so. As I haven't found one, here's a quick guide on how to integrate Oracle into Play/Slick app.


Oracle is supported via a closed-source slick-extensions plugin from Typesafe that wraps JDBC driver. Pull it into your build by adding slick-extensions library and appropriate version of play-slick module to your build:

libraryDependencies ++= "com.typesafe.slick" %% "slick-extensions" % "2.0.0" ::
                        "" %% "play-slick" % "0.8.0" ::


In Play application.conf file set your database connection settings to (whereas default is db name):  


In your model classes import and you’re good to go.

Known Issues

A known issue with Oracle database is that whenever passing an empty value or nothing with an AutoInc index the db complains. To solve the issue you must provide the value which effectively means no AutoInc at all. Thus, I employed a simple solution of creating a spin-off data object without the id (and in most cases it is also my domain object as I usually don’t need ids) and then map it into the DB-compatible one. For the last task you might use a type class (I would not recommend using implicit conversion).