Skip to content

Commit

Permalink
update mysql-connector-java to 8.0.28
Browse files Browse the repository at this point in the history
- fix one ResultSet.first() function call which is now illegal for
        a forward only result set (the default type)
  • Loading branch information
sheridancbio committed Mar 19, 2024
1 parent e388941 commit 00be8b2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<maf.version>1.0.0</maf.version>


<mysql_driver.version>5.1.48</mysql_driver.version>
<mysql_driver.version>8.0.28</mysql_driver.version>
<mysql_commons_lang3.version>3.13.0</mysql_commons_lang3.version>

<commons_dbcp2.version>2.10.0</commons_dbcp2.version>
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/mskcc/cbio/portal/dao/JdbcDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public String getLabel() {
}
}

public JdbcDataSource () {
public JdbcDataSource() {
DatabaseProperties dbProperties = DatabaseProperties.getInstance();
logUsedDeprecatedProperties(dbProperties);
// extract required property values
Expand All @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/mskcc/cbio/portal/dao/MySQLbulkLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
14 changes: 13 additions & 1 deletion src/main/resources/applicationContext-persistenceConnections.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@
<property name="mapperLocations" value="classpath*:org/cbioportal/persistence/mybatis/**/*.xml" />
<property name="databaseIdProvider" ref="databaseIdProvider"/>
</bean>
<!-- configure the data source to allow LOAD DATA LOCAL INFILE ... -->
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="businessDataSource"/>
<property name="targetMethod" value="addConnectionProperty"/>
<property name="arguments">
<list>
<value>allowLoadLocalInfile</value>
<value>true</value>
</list>
</property>
</bean>
</beans>

<beans profile="dbcp">
Expand All @@ -98,4 +109,5 @@
</property>
</bean>
</beans>
</beans>

</beans>
12 changes: 12 additions & 0 deletions src/test/resources/applicationContext-dao.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@
<property name="databaseIdProvider" ref="databaseIdProvider"/>
</bean>

<!-- configure the data source to allow LOAD DATA LOCAL INFILE ... -->
<b:bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<b:property name="targetObject" ref="businessDataSource"/>
<b:property name="targetMethod" value="addConnectionProperty"/>
<b:property name="arguments">
<b:list>
<b:value>allowLoadLocalInfile</b:value>
<b:value>true</b:value>
</b:list>
</b:property>
</b:bean>

<!-- scan for mappers and let them be autowired -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="org.mskcc.cbio.portal.persistence,org.cbioportal.persistence.mybatis" />
Expand Down

0 comments on commit 00be8b2

Please sign in to comment.