Scala
SQLServer
PlayFramework
slick

Scala 2.12.4 Play Framework 2.6.x Play-Slick で SQLServer へ接続する

Scala, PlayFramework, IntelliJ IDEAの初心者. Scala学習前にDB接続環境を事前に確認した.

検証環境

Play-Slick関連説明資料

Using Play Slick

Play Slick currently supports Slick 3.2 with Play 2.6, for Scala 2.12 and Scala 2.11.

JDBC driver dependency
The Play Slick module does not bundle any JDBC driver. Hence, you will need to explicitly add the JDBC driver(s) you want to use in your application.

Third, in the above configuration slick.dbs.default.profile is used to configure the Slick profile, while slick.dbs.default.db.driver is the underlying JDBC driver used by Slick’s backend. In the above configuration >we are configuring Slick to use H2 database, but Slick supports several other databases. Check the Slick documentation for a complete list of supported databases, and to find a matching Slick driver.

Slick 3.2.0 manual UPGRADE GUIDES

Slick Extensions
The Slick Extensions package with additional profiles for Oracle, DB2 and SQL Server does not exist anymore for Slick 3.2. These profiles have been added to the core Slick package:

OracleProfile
DB2Profile
SQLServerProfile

SQLServerProfile

slick.jdbc.SQLServerProfile

DB接続設定

下記の通り, 依存ライブラリ・データベースを定義する.

build.sbt
libraryDependencies += "com.microsoft.sqlserver" % "mssql-jdbc" % "6.2.1.jre8"
conf.application.conf
slick.dbs.default.profile = "slick.jdbc.SQLServerProfile$"
slick.dbs.default.db.driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
slick.dbs.default.db.url = "jdbc:sqlserver://host:port;databaseName=db"
slick.dbs.default.db.user = "user"
slick.dbs.default.db.password = "password"

日本語名のデータベース・テーブルへ接続できた! <- これが検証したかった事.