From 00be8b205de51ea251771b3e7b43a9d0d27f6904 Mon Sep 17 00:00:00 2001
From: Robert Sheridan <7747489+sheridancbio@users.noreply.github.com>
Date: Mon, 18 Mar 2024 16:43:37 -0400
Subject: [PATCH] update mysql-connector-java to 8.0.28
- fix one ResultSet.first() function call which is now illegal for
a forward only result set (the default type)
---
pom.xml | 2 +-
.../org/mskcc/cbio/portal/dao/JdbcDataSource.java | 5 ++++-
.../org/mskcc/cbio/portal/dao/MySQLbulkLoader.java | 4 +---
.../applicationContext-persistenceConnections.xml | 14 +++++++++++++-
src/test/resources/applicationContext-dao.xml | 12 ++++++++++++
5 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3b030136..802d5ce8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
1.0.0
- 5.1.48
+ 8.0.28
3.13.0
2.10.0
diff --git a/src/main/java/org/mskcc/cbio/portal/dao/JdbcDataSource.java b/src/main/java/org/mskcc/cbio/portal/dao/JdbcDataSource.java
index a16ef9f9..eb8a1a32 100644
--- a/src/main/java/org/mskcc/cbio/portal/dao/JdbcDataSource.java
+++ b/src/main/java/org/mskcc/cbio/portal/dao/JdbcDataSource.java
@@ -38,7 +38,7 @@ public String getLabel() {
}
}
- public JdbcDataSource () {
+ public JdbcDataSource() {
DatabaseProperties dbProperties = DatabaseProperties.getInstance();
logUsedDeprecatedProperties(dbProperties);
// extract required property values
@@ -65,6 +65,9 @@ public JdbcDataSource () {
this.setDriverClassName(mysqlDriverClassName);
// Disable this to avoid caching statements
this.setPoolPreparedStatements(Boolean.valueOf(enablePooling));
+ // this property setting is needed to enable MySQLbulkLoader to load data from a local file
+ // this is set here in case this class is initialized via JdbcUtil (not expected), but is also set in applicationContext resource files.
+ this.addConnectionProperty("allowLoadLocalInfile", "true");
// these values are from the production cbioportal application context for a jndi data source
this.setMaxTotal(500);
this.setMaxIdle(30);
diff --git a/src/main/java/org/mskcc/cbio/portal/dao/MySQLbulkLoader.java b/src/main/java/org/mskcc/cbio/portal/dao/MySQLbulkLoader.java
index c9b23e64..3414fc4b 100644
--- a/src/main/java/org/mskcc/cbio/portal/dao/MySQLbulkLoader.java
+++ b/src/main/java/org/mskcc/cbio/portal/dao/MySQLbulkLoader.java
@@ -84,10 +84,8 @@ public static int flushAll() throws DaoException {
con = JdbcUtil.getDbConnection(MySQLbulkLoader.class);
stmt = con.prepareStatement("SELECT @@foreign_key_checks;");
ResultSet result = stmt.executeQuery();
-
- result.first();
+ result.next();
checks = result.getInt(1);
-
stmt = con.prepareStatement("SET foreign_key_checks = ?;");
stmt.setLong(1, 0);
stmt.execute();
diff --git a/src/main/resources/applicationContext-persistenceConnections.xml b/src/main/resources/applicationContext-persistenceConnections.xml
index 91b9737a..82ce4aa5 100644
--- a/src/main/resources/applicationContext-persistenceConnections.xml
+++ b/src/main/resources/applicationContext-persistenceConnections.xml
@@ -74,6 +74,17 @@
+
+
+
+
+
+
+ allowLoadLocalInfile
+ true
+
+
+
@@ -98,4 +109,5 @@
-
\ No newline at end of file
+
+
diff --git a/src/test/resources/applicationContext-dao.xml b/src/test/resources/applicationContext-dao.xml
index 5e5fce64..e0fbe55b 100644
--- a/src/test/resources/applicationContext-dao.xml
+++ b/src/test/resources/applicationContext-dao.xml
@@ -88,6 +88,18 @@
+
+
+
+
+
+
+ allowLoadLocalInfile
+ true
+
+
+
+