使用 slick 将 MySQL 连接到 Scala
Connecting MySQL to Scala using slick
我正在尝试使用 slick 3.1 连接 MySQL 数据库做 scala 应用程序
在 Typesafe 提供的 demo 中,这段代码被用作 application.conf :
h2mem1 = {
url = "jdbc:h2:mem:test1"
driver = org.h2.Driver
connectionPool = disabled
keepAliveConnection = true
}
我是 ampps apache 服务器上的 运行 MySQL 数据库,现在我对输入什么 url 和驱动程序感到困惑,以便我的应用程序可以连接到数据库?
我的 url 应该是 "localhost" 吗?
像这样:
database = {
url = "jdbc:mysql://localhost/test"
user = "user"
password = "pwd"
driver = com.mysql.jdbc.Driver
connectionPool = disabled
keepAliveConnection = true
}
我正在尝试使用 slick 3.1 连接 MySQL 数据库做 scala 应用程序 在 Typesafe 提供的 demo 中,这段代码被用作 application.conf :
h2mem1 = {
url = "jdbc:h2:mem:test1"
driver = org.h2.Driver
connectionPool = disabled
keepAliveConnection = true
}
我是 ampps apache 服务器上的 运行 MySQL 数据库,现在我对输入什么 url 和驱动程序感到困惑,以便我的应用程序可以连接到数据库? 我的 url 应该是 "localhost" 吗?
像这样:
database = {
url = "jdbc:mysql://localhost/test"
user = "user"
password = "pwd"
driver = com.mysql.jdbc.Driver
connectionPool = disabled
keepAliveConnection = true
}