我正在尝试通过play(1.2.4)+ mysql优化批量插入。 我看到一些帖子谈到将以下内容添加到jdbc配置中(将其添加到连接字符串中):useServerPrepStmts = false& rewriteBatchedStatements = true& useCompression = true
我试过:
db=mysql://root@localhost/data?useServerPrepStmts=false&rewriteBatchedStatements=true&useCompression=true
但是我收到了这个错误:
A database error occured : Cannot connected to the database, The connection property 'useCompression' only accepts values of the form: 'true', 'false', 'yes' or 'no'. The value 'true?useUnicode=yes' is not in this set.
我也尝试使用db = jdbc:mysql:// ....
仍然没有运气。 我错过了什么?
答案 0 :(得分:0)
Play会自动使用以下内容附加MySQL连接字符串:
?useUnicode=yes&characterEncoding=UTF-8&connectionCollation=utf8_general_ci
所以我猜你的连接字符串最终无效,因为现在有两组参数(以问号开头)。
不幸的是,Play代码的那部分在DBPlugin类中是非常硬编码的,这意味着你无法以这种方式添加选项。您将不得不寻找一种方法来改变后期的选项。