Slick 2.1.x Invalid query because of `

47 views Asked by At

I am working on legacy code which was written in slick 2.1 (can't upgrade right now).

 val query = foo.filter(x => x.d >= input._1).filter(x => x.d < input._2)
 println(query.selectStatement)
 query.list

I can see that this generate the query

select x2.`a`, x2.`b`, x2.`c`, x2.`d` from `foo` x2 where (x2.`d` >= {ts '2016-07-30 00:00:00.0'}) and (x2.`d` < {ts '2016-07-30 23:23:59.0'})

when this executes, it gives an error java.sql.SQLSyntaxErrorException: ORA-00911: invalid character

When I copy paste this printed query into Oracle query editor it gives the same error there. However if I remove all the ```s then it works. Why is slick 2.1.x generate bad query? is there anyway to tell it to stop generating "`"s

1

There are 1 answers

0
Knows Not Much On

I found the answer. I had imported the wrong driver. I had imported MySQLDriver and was trying to execute the code against Oracle.

Importing the right OracleDriver (via slick-extensions) generated the right query.