Improve options passed to MySQL driver

This commit is contained in:
Graham Triggs 2017-09-20 15:08:40 +01:00
parent 8e067aa6f0
commit b8583b63d8

View file

@ -86,18 +86,24 @@ public class SDBDataSource {
// horrible nastiness ensues.
if (DEFAULT_TYPE.equals(getDbType())) {
if (!url.contains("?")) {
url += "?useUnicode=yes&characterEncoding=utf8&nullNamePatternMatchesAll=true";
url += "?useUnicode=yes&characterEncoding=utf8&nullNamePatternMatchesAll=true&cachePrepStmts=true&useServerPrepStmts=true";
} else {
String urlLwr = url.toLowerCase();
if (!urlLwr.contains("useunicode")) {
url += "&useUnicode=yes";
}
if (urlLwr.contains("characterencoding")) {
if (!urlLwr.contains("characterencoding")) {
url += "&characterEncoding=utf8";
}
if (urlLwr.contains("nullnamepatternmatchesall")) {
if (!urlLwr.contains("nullnamepatternmatchesall")) {
url += "&nullNamePatternMatchesAll=true";
}
if (!urlLwr.contains("cacheprepstmts")) {
url += "&cachePrepStmts=true";
}
if (!urlLwr.contains("useserverprepstmts")) {
url += "&useServerPrepStmts=true";
}
}
}