Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
elexis-3-core
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
elexis
elexis-3-core
Commits
4703e34e
Commit
4703e34e
authored
Oct 04, 2019
by
Thomas Huster
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[16606] added applyMySqlTimeZoneWorkaround to CoreUtil getDBConnection
parent
077f8911
Pipeline
#11465
passed with stages
in 4 minutes and 22 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
bundles/ch.elexis.core/src/ch/elexis/core/utils/CoreUtil.java
...les/ch.elexis.core/src/ch/elexis/core/utils/CoreUtil.java
+19
-0
No files found.
bundles/ch.elexis.core/src/ch/elexis/core/utils/CoreUtil.java
View file @
4703e34e
...
...
@@ -103,6 +103,7 @@ public class CoreUtil {
if
(!
StringUtils
.
isEmpty
((
String
)
hConn
.
get
(
Preferences
.
CFG_FOLDED_CONNECTION_CONNECTSTRING
)))
{
String
url
=
(
String
)
hConn
.
get
(
Preferences
.
CFG_FOLDED_CONNECTION_CONNECTSTRING
);
url
=
applyMySqlTimeZoneWorkaround
(
url
);
ret
.
connectionString
=
url
;
DBConnection
.
getHostName
(
url
).
ifPresent
(
h
->
ret
.
hostName
=
h
);
DBConnection
.
getDatabaseName
(
url
).
ifPresent
(
db
->
ret
.
databaseName
=
db
);
...
...
@@ -135,6 +136,24 @@ public class CoreUtil {
return
Optional
.
empty
();
}
/**
* @since 3.8 due to mysql jdbc update a timezone problem may exist, see e.g.
* https://github.com/elexis/elexis-3-core/issues/273 - we fix this by adding this
* parameter if not yet included
*/
private
static
String
applyMySqlTimeZoneWorkaround
(
String
dbConnectString
){
if
(
dbConnectString
.
startsWith
(
"jdbc:mysql:"
)
&&
!
dbConnectString
.
contains
(
"serverTimezone"
))
{
if
(
dbConnectString
.
contains
(
"?"
))
{
dbConnectString
+=
"&serverTimezone=Europe/Zurich"
;
}
else
{
dbConnectString
+=
"?serverTimezone=Europe/Zurich"
;
}
logger
.
info
(
"MySQL dbConnection string correction [{}]"
,
dbConnectString
);
}
return
dbConnectString
;
}
/**
*
* @return a {@link Hashtable} containing the connection parameters, use
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment