【发布时间】:2020-03-03 07:58:24
【问题描述】:
我目前正在基于 Vert.x(Kotlin) 构建项目,我需要连接到 MySQL 服务器。 Vert.x 提供了这个作为 MySQL 连接的解决方案 - https://vertx.io/docs/vertx-mysql-client/kotlin
我注意到有两种方法可以实现这一点。
// Connect options
var connectOptions = MySQLConnectOptions(
port = 3306,
host = "the-host",
database = "the-db",
user = "user",
password = "secret")
// Pool options
var poolOptions = PoolOptions(
maxSize = 5)
// Create the pooled client
var client = MySQLPool.pool(connectOptions, poolOptions)
还有
// Connect options
var connectOptions = MySQLConnectOptions(
port = 3306,
host = "the-host",
database = "the-db",
user = "user",
password = "secret")
// Pool options
var poolOptions = PoolOptions(
maxSize = 5)
// Create the pooled client
var client = MySQLPool.pool(vertx, connectOptions, poolOptions)
Vert.x 没有提到在什么情况下应该通过 vertx,有人知道吗?我们什么时候应该使用第二种实现方式?
【问题讨论】:
标签: mysql kotlin vert.x vert.x-webclient