rikusen0335
11/27/2019, 2:20 PMvar db: Database
override fun onEnable() {
// Enabled message
server.consoleSender.sendMessage("%sSamplePlugin is now enabled!".format(ChatColor.GREEN))
server.pluginManager.registerEvents(this, this)
val basePath: Path = Paths.get(System.getProperty("user.dir")).toRealPath()
val sqliteFile: Path = Paths.get(basePath.toString(), "sample.db")
print(sqliteFile) // Show the paths
db = Database.connect("jdbc:sqlite:file:$sqliteFile", "org.sqlite.JDBC")
TransactionManager.manager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE
}
override fun onDisable() {
TransactionManager.closeAndUnregister(db) // Disconnect処理?
}
Evan R.
11/27/2019, 2:26 PMnewTransaction()
. It’s all detailed here: https://github.com/JetBrains/Exposed/wiki/DataBase-and-DataSource and here: https://github.com/JetBrains/Exposed/wiki/Transactions#working-with-a-multiple-databases