MS SQL configuration using Slick 2.0.1 and Playframework 2.2.2

When I try to use the new proprietary MS SQL driver, I get an exception that boils down to the ClassNotFound class for the driver class.

I include both slick and slick extensions:

"com.typesafe.slick" %% "slick" % "2.0.1",
"com.typesafe.slick" %% "slick-extensions" % "2.0.1"

Usage example:

import com.typesafe.slick.driver.ms.SQLServerDriver.simple._

Database.forURL(url="jdbc:sqlserver://hostname:1433;databaseName=thedb1", driver = "com.typesafe.slick.driver.ms.SQLServerDriver", user="user", password="password" ) withSession { ...

An exception:

Ultimately, ClassNotFound for com.typesafe.slick.driver.ms.SQLServerDriver.

+4
source share
1 answer

I ran into the same problem and was able to solve it by specifying the following lines in the application.conf file (thanks to help from play-slick contributors here ):

db.default.slickdriver=com.typesafe.slick.driver.ms.SQLServerDriver
db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver

jTDS sourceforge, .

db.default.slickdriver=com.typesafe.slick.driver.ms.SQLServerDriver
db.default.driver=net.sourceforge.jtds.jdbc.Driver

, sqljdbc4.jar ( ) {play app root}/lib. jTDS build.sbt, .

+3

Source: https://habr.com/ru/post/1534549/


All Articles