Connector changes from mysql to drizzle
This commit is contained in:
@@ -201,7 +201,7 @@ configurations {
|
|||||||
driver
|
driver
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
driver 'mysql:mysql-connector-java:5.1.16'
|
driver 'org.drizzle.jdbc:drizzle-jdbc:1.3'
|
||||||
}
|
}
|
||||||
|
|
||||||
URLClassLoader loader = GroovyObject.class.classLoader
|
URLClassLoader loader = GroovyObject.class.classLoader
|
||||||
@@ -211,17 +211,17 @@ configurations.driver.each {File file ->
|
|||||||
|
|
||||||
task createDB<<{
|
task createDB<<{
|
||||||
description= "Creates the Database. Needs database name to be passed (like: -PdbName=someDBname)"
|
description= "Creates the Database. Needs database name to be passed (like: -PdbName=someDBname)"
|
||||||
sql = Sql.newInstance( 'jdbc:mysql://localhost:3306/', mysqlUser, mysqlPassword, 'com.mysql.jdbc.Driver' )
|
sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' )
|
||||||
sql.execute( 'create database '+"`$dbName`" )
|
sql.execute( 'create database '+"`$dbName`" )
|
||||||
}
|
}
|
||||||
|
|
||||||
task dropDB<<{
|
task dropDB<<{
|
||||||
description= "Drops the specified database. The database name has to be passed (like: -PdbName=someDBname)"
|
description= "Drops the specified database. The database name has to be passed (like: -PdbName=someDBname)"
|
||||||
sql = Sql.newInstance( 'jdbc:mysql://localhost:3306/', mysqlUser, mysqlPassword, 'com.mysql.jdbc.Driver' )
|
sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' )
|
||||||
sql.execute( 'DROP DATABASE '+"`$dbName`")
|
sql.execute( 'DROP DATABASE '+"`$dbName`")
|
||||||
}
|
}
|
||||||
task setBlankPassword<<{
|
task setBlankPassword<<{
|
||||||
sql = Sql.newInstance( 'jdbc:mysql://localhost:3306/', mysqlUser, mysqlPassword, 'com.mysql.jdbc.Driver' )
|
sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' )
|
||||||
sql.execute('USE `mifosplatform-tenants`')
|
sql.execute('USE `mifosplatform-tenants`')
|
||||||
sql.execute('UPDATE mifosplatform-tenants.tenants SET schema_server = \'localhost\', schema_server_port = \'3306\', schema_username = \'mifos\', schema_password = \'mysql\' WHERE id=1;')
|
sql.execute('UPDATE mifosplatform-tenants.tenants SET schema_server = \'localhost\', schema_server_port = \'3306\', schema_username = \'mifos\', schema_password = \'mysql\' WHERE id=1;')
|
||||||
}
|
}
|
||||||
@@ -235,13 +235,13 @@ buildscript {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.flywaydb:flyway-gradle-plugin:3.0" // version upgraded during Spring Boot & MariaDB4j work, as prev. used v0.2 didn't work well after *.sql moved from fineract-db to fineract-provider/src/main/resources (new version also has clearer errors, e.g. in case of missing DB)
|
classpath "org.flywaydb:flyway-gradle-plugin:3.0" // version upgraded during Spring Boot & MariaDB4j work, as prev. used v0.2 didn't work well after *.sql moved from fineract-db to fineract-provider/src/main/resources (new version also has clearer errors, e.g. in case of missing DB)
|
||||||
classpath 'mysql:mysql-connector-java:5.1.22'
|
classpath 'org.drizzle.jdbc:drizzle-jdbc:1.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
flyway {
|
flyway {
|
||||||
url = "jdbc:mysql://localhost:3306/mifostenant-default"
|
url = "jdbc:mysql:thin://localhost:3306/mifostenant-default"
|
||||||
user = mysqlUser
|
user = mysqlUser
|
||||||
password = mysqlPassword
|
password = mysqlPassword
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ task migrateTenantDB<<{
|
|||||||
tenantDbName = rootProject.getProperty("dbName")
|
tenantDbName = rootProject.getProperty("dbName")
|
||||||
}
|
}
|
||||||
|
|
||||||
flyway.url= "jdbc:mysql://localhost:3306/$tenantDbName"
|
flyway.url= "jdbc:mysql:thin://localhost:3306/$tenantDbName"
|
||||||
flyway.locations= [filePath]
|
flyway.locations= [filePath]
|
||||||
/**We use ${ as the prefix for strecthy reporting, do not want them to be interpreted by Flyway**/
|
/**We use ${ as the prefix for strecthy reporting, do not want them to be interpreted by Flyway**/
|
||||||
flyway.placeholderPrefix = "\$\${"
|
flyway.placeholderPrefix = "\$\${"
|
||||||
@@ -271,7 +271,7 @@ task showTenantDBInfo<<{
|
|||||||
tenantDbName = rootProject.getProperty("dbName")
|
tenantDbName = rootProject.getProperty("dbName")
|
||||||
}
|
}
|
||||||
|
|
||||||
flyway.url= "jdbc:mysql://localhost:3306/$tenantDbName"
|
flyway.url= "jdbc:mysql:thin://localhost:3306/$tenantDbName"
|
||||||
flyway.locations= [filePath]
|
flyway.locations= [filePath]
|
||||||
flywayInfo.execute()
|
flywayInfo.execute()
|
||||||
}
|
}
|
||||||
@@ -286,7 +286,7 @@ task migrateTenantListDB<<{
|
|||||||
tenantsDbName = rootProject.getProperty("dbName")
|
tenantsDbName = rootProject.getProperty("dbName")
|
||||||
}
|
}
|
||||||
|
|
||||||
flyway.url= "jdbc:mysql://localhost:3306/$tenantsDbName"
|
flyway.url= "jdbc:mysql:thin://localhost:3306/$tenantsDbName"
|
||||||
flyway.locations= [filePath]
|
flyway.locations= [filePath]
|
||||||
|
|
||||||
flywayMigrate.execute()
|
flywayMigrate.execute()
|
||||||
@@ -301,7 +301,7 @@ task showTenantListDBInfo<<{
|
|||||||
tenantsDbName = rootProject.getProperty("dbName")
|
tenantsDbName = rootProject.getProperty("dbName")
|
||||||
}
|
}
|
||||||
|
|
||||||
flyway.url= "jdbc:mysql://localhost:3306/$tenantsDbName"
|
flyway.url= "jdbc:mysql:thin://localhost:3306/$tenantsDbName"
|
||||||
flyway.locations= [filePath]
|
flyway.locations= [filePath]
|
||||||
flywayInfo.execute()
|
flywayInfo.execute()
|
||||||
}
|
}
|
||||||
@@ -315,7 +315,7 @@ task repairTenantDB<<{
|
|||||||
tenantsDbName = rootProject.getProperty("dbName")
|
tenantsDbName = rootProject.getProperty("dbName")
|
||||||
}
|
}
|
||||||
|
|
||||||
flyway.url= "jdbc:mysql://localhost:3306/$tenantsDbName"
|
flyway.url= "jdbc:mysql:thin://localhost:3306/$tenantsDbName"
|
||||||
flyway.locations= [filePath]
|
flyway.locations= [filePath]
|
||||||
flywayRepair.execute()
|
flywayRepair.execute()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,13 +41,14 @@ dependencies {
|
|||||||
[group: 'com.google.guava', name: 'guava', version: '15.0'],
|
[group: 'com.google.guava', name: 'guava', version: '15.0'],
|
||||||
|
|
||||||
[group: 'joda-time', name: 'joda-time', version: '2.4'],
|
[group: 'joda-time', name: 'joda-time', version: '2.4'],
|
||||||
[group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'],
|
//[group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'],
|
||||||
[group: 'org.apache.commons', name: 'commons-email', version: '1.3.3'],
|
[group: 'org.apache.commons', name: 'commons-email', version: '1.3.3'],
|
||||||
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
|
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
|
||||||
|
|
||||||
// no slf4j & logback here (anymore), as spring-boot-starter-logging already brings this now, better assembled (log4j-over-slf4j was originally forgotten here)
|
// no slf4j & logback here (anymore), as spring-boot-starter-logging already brings this now, better assembled (log4j-over-slf4j was originally forgotten here)
|
||||||
|
|
||||||
[group: 'mysql', name: 'mysql-connector-java', version: '5.1.27'],
|
//[group: 'mysql', name: 'mysql-connector-java', version: '5.1.27'],
|
||||||
|
[group: 'org.drizzle.jdbc', name: 'drizzle-jdbc', version: '1.3'],
|
||||||
// [group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: tomcatVersion],
|
// [group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: tomcatVersion],
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,13 +40,14 @@ dependencies {
|
|||||||
[group: 'com.google.guava', name: 'guava', version: '15.0'],
|
[group: 'com.google.guava', name: 'guava', version: '15.0'],
|
||||||
|
|
||||||
[group: 'joda-time', name: 'joda-time', version: '2.4'],
|
[group: 'joda-time', name: 'joda-time', version: '2.4'],
|
||||||
[group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'],
|
//[group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'],
|
||||||
[group: 'org.apache.commons', name: 'commons-email', version: '1.3.3'],
|
[group: 'org.apache.commons', name: 'commons-email', version: '1.3.3'],
|
||||||
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
|
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
|
||||||
|
|
||||||
// no slf4j & logback here (anymore), as spring-boot-starter-logging already brings this now, better assembled (log4j-over-slf4j was originally forgotten here)
|
// no slf4j & logback here (anymore), as spring-boot-starter-logging already brings this now, better assembled (log4j-over-slf4j was originally forgotten here)
|
||||||
|
|
||||||
[group: 'mysql', name: 'mysql-connector-java', version: '5.1.27'],
|
//[group: 'mysql', name: 'mysql-connector-java', version: '5.1.27'],
|
||||||
|
[group: 'org.drizzle.jdbc', name: 'drizzle-jdbc', version: '1.3'],
|
||||||
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: tomcatVersion],
|
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: tomcatVersion],
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+16
-15
@@ -21,6 +21,7 @@ package org.apache.fineract.accounting.journalentry.service;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -141,7 +142,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
|||||||
|
|
||||||
List<Map<String, Object>> list = jdbcTemplate.queryForList(organizationRunningBalanceSql, entityDate, entityDate);
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(organizationRunningBalanceSql, entityDate, entityDate);
|
||||||
for (Map<String, Object> entries : list) {
|
for (Map<String, Object> entries : list) {
|
||||||
Long accountId = (Long) entries.get("accountId");
|
Long accountId = Long.parseLong(entries.get("accountId").toString()); //Drizzle is returning Big Integer where as MySQL returns Long.
|
||||||
if (!runningBalanceMap.containsKey(accountId)) {
|
if (!runningBalanceMap.containsKey(accountId)) {
|
||||||
runningBalanceMap.put(accountId, (BigDecimal) entries.get("runningBalance"));
|
runningBalanceMap.put(accountId, (BigDecimal) entries.get("runningBalance"));
|
||||||
}
|
}
|
||||||
@@ -149,8 +150,8 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
|||||||
|
|
||||||
List<Map<String, Object>> officesRunningBalanceList = jdbcTemplate.queryForList(officesRunningBalanceSql, entityDate, entityDate);
|
List<Map<String, Object>> officesRunningBalanceList = jdbcTemplate.queryForList(officesRunningBalanceSql, entityDate, entityDate);
|
||||||
for (Map<String, Object> entries : officesRunningBalanceList) {
|
for (Map<String, Object> entries : officesRunningBalanceList) {
|
||||||
Long accountId = (Long) entries.get("accountId");
|
Long accountId = Long.parseLong(entries.get("accountId").toString());
|
||||||
Long officeId = (Long) entries.get("officeId");
|
Long officeId = Long.parseLong(entries.get("officeId").toString());
|
||||||
Map<Long, BigDecimal> runningBalance = null;
|
Map<Long, BigDecimal> runningBalance = null;
|
||||||
if (officesRunningBalance.containsKey(officeId)) {
|
if (officesRunningBalance.containsKey(officeId)) {
|
||||||
runningBalance = officesRunningBalance.get(officeId);
|
runningBalance = officesRunningBalance.get(officeId);
|
||||||
@@ -168,10 +169,10 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
|||||||
if (entryDatas.size() > 0) {
|
if (entryDatas.size() > 0) {
|
||||||
// run a batch update of 1000 SQL statements at a time
|
// run a batch update of 1000 SQL statements at a time
|
||||||
final Integer batchUpdateSize = 1000;
|
final Integer batchUpdateSize = 1000;
|
||||||
final Integer batchUpdateSizeMinusOne = batchUpdateSize - 1;
|
ArrayList<String> updateSql = new ArrayList<>();
|
||||||
String[] updateSql = new String[batchUpdateSize];
|
int batchIndex = 0;
|
||||||
int i = 0;
|
for (int index = 0 ; index < entryDatas.size() ; index++) {
|
||||||
for (JournalEntryData entryData : entryDatas) {
|
JournalEntryData entryData = entryDatas.get(index) ;
|
||||||
Map<Long, BigDecimal> officeRunningBalanceMap = null;
|
Map<Long, BigDecimal> officeRunningBalanceMap = null;
|
||||||
if (officesRunningBalance.containsKey(entryData.getOfficeId())) {
|
if (officesRunningBalance.containsKey(entryData.getOfficeId())) {
|
||||||
officeRunningBalanceMap = officesRunningBalance.get(entryData.getOfficeId());
|
officeRunningBalanceMap = officesRunningBalance.get(entryData.getOfficeId());
|
||||||
@@ -183,18 +184,18 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
|||||||
BigDecimal runningBalance = calculateRunningBalance(entryData, runningBalanceMap);
|
BigDecimal runningBalance = calculateRunningBalance(entryData, runningBalanceMap);
|
||||||
String sql = "UPDATE acc_gl_journal_entry je SET je.is_running_balance_calculated=1, je.organization_running_balance="
|
String sql = "UPDATE acc_gl_journal_entry je SET je.is_running_balance_calculated=1, je.organization_running_balance="
|
||||||
+ runningBalance + ",je.office_running_balance=" + officeRunningBalance + " WHERE je.id=" + entryData.getId();
|
+ runningBalance + ",je.office_running_balance=" + officeRunningBalance + " WHERE je.id=" + entryData.getId();
|
||||||
updateSql[i++] = sql;
|
updateSql.add(sql) ;
|
||||||
|
batchIndex++ ;
|
||||||
if (i == batchUpdateSizeMinusOne) {
|
if (batchIndex == batchUpdateSize || index == entryDatas.size()-1) {
|
||||||
// run a batch update of the 1000 update SQL statements
|
// run a batch update of the 1000 update SQL statements
|
||||||
this.jdbcTemplate.batchUpdate(updateSql);
|
String[] batch = new String[updateSql.size()] ;
|
||||||
|
updateSql.toArray(batch) ;
|
||||||
|
this.jdbcTemplate.batchUpdate(batch);
|
||||||
// reset counter and string array
|
// reset counter and string array
|
||||||
i = 0;
|
batchIndex = 0;
|
||||||
updateSql = new String[batchUpdateSize];
|
updateSql.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.jdbcTemplate.batchUpdate(updateSql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.core.boot.db;
|
|||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.apache.tomcat.jdbc.pool.PoolProperties;
|
import org.apache.tomcat.jdbc.pool.PoolProperties;
|
||||||
|
import org.drizzle.jdbc.DrizzleDriver;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ public class DataSourceProperties extends PoolProperties {
|
|||||||
@Value("${" + PROTOCOL + ":jdbc}")
|
@Value("${" + PROTOCOL + ":jdbc}")
|
||||||
private volatile @NotNull String jdbcProtocol;
|
private volatile @NotNull String jdbcProtocol;
|
||||||
|
|
||||||
@Value("${" + SUBPROTOCOL + ":mysql}")
|
@Value("${" + SUBPROTOCOL + ":mysql:thin}")
|
||||||
private volatile @NotNull String jdbcSubprotocol;
|
private volatile @NotNull String jdbcSubprotocol;
|
||||||
|
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ public class DataSourceProperties extends PoolProperties {
|
|||||||
|
|
||||||
// default to save us from re-specifying this; note that it can still be
|
// default to save us from re-specifying this; note that it can still be
|
||||||
// overridden
|
// overridden
|
||||||
setDriverClassName(com.mysql.jdbc.Driver.class.getName());
|
setDriverClassName(DrizzleDriver.class.getName());
|
||||||
|
|
||||||
setDefaults();
|
setDefaults();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -78,7 +78,7 @@ public class FineractPlatformTenantConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String databaseURL() {
|
public String databaseURL() {
|
||||||
final String url = new StringBuilder("jdbc:mysql://").append(this.schemaServer).append(':').append(this.schemaServerPort)
|
final String url = new StringBuilder("jdbc:mysql:thin://").append(this.schemaServer).append(':').append(this.schemaServerPort)
|
||||||
.append('/').append(this.schemaName).toString();
|
.append('/').append(this.schemaName).toString();
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -22,14 +22,13 @@ import java.sql.Driver;
|
|||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
|
import org.apache.fineract.infrastructure.jobs.service.JobRegisterServiceImpl;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.event.ContextClosedEvent;
|
import org.springframework.context.event.ContextClosedEvent;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.mysql.jdbc.AbandonedConnectionCleanupThread;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class AbandonedConnectionCleanupShutdownListener implements ApplicationListener<ContextClosedEvent> {
|
public class AbandonedConnectionCleanupShutdownListener implements ApplicationListener<ContextClosedEvent> {
|
||||||
|
|
||||||
@@ -45,12 +44,13 @@ public class AbandonedConnectionCleanupShutdownListener implements ApplicationLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void shutDowncleanUpThreadAndDeregisterJDBCDriver() {
|
private void shutDowncleanUpThreadAndDeregisterJDBCDriver() {
|
||||||
try {
|
/*try {
|
||||||
AbandonedConnectionCleanupThread.shutdown();
|
|
||||||
logger.info("Shut-down of AbandonedConnectionCleanupThread successful");
|
AbandonedConnectionCleanupThread.shutdown(); tomcat memoroy leak with mysql connector. With Drizzle not required
|
||||||
|
logger.info("Shut-down of AbandonedConnectionCleanupThread successful");
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
logger.error("Exception occurred while shut-down of AbandonedConnectionCleanupThread", t);
|
logger.error("Exception occurred while shut-down of AbandonedConnectionCleanupThread", t);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// This manually deregisters JDBC driver, which prevents Tomcat 7 from
|
// This manually deregisters JDBC driver, which prevents Tomcat 7 from
|
||||||
// complaining about memory leaks
|
// complaining about memory leaks
|
||||||
|
|||||||
+4
-1
@@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import com.googlecode.flyway.core.Flyway;
|
import com.googlecode.flyway.core.Flyway;
|
||||||
import com.googlecode.flyway.core.api.FlywayException;
|
import com.googlecode.flyway.core.api.FlywayException;
|
||||||
|
import com.googlecode.flyway.core.util.jdbc.DriverDataSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service that picks up on tenants that are configured to auto-update their
|
* A service that picks up on tenants that are configured to auto-update their
|
||||||
@@ -41,6 +42,7 @@ import com.googlecode.flyway.core.api.FlywayException;
|
|||||||
@Service
|
@Service
|
||||||
public class TenantDatabaseUpgradeService {
|
public class TenantDatabaseUpgradeService {
|
||||||
|
|
||||||
|
private final String DRIVER_CLASS = "org.drizzle.jdbc.DrizzleDriver" ;
|
||||||
private final TenantDetailsService tenantDetailsService;
|
private final TenantDetailsService tenantDetailsService;
|
||||||
protected final DataSource tenantDataSource;
|
protected final DataSource tenantDataSource;
|
||||||
protected final TenantDataSourcePortFixService tenantDataSourcePortFixService;
|
protected final TenantDataSourcePortFixService tenantDataSourcePortFixService;
|
||||||
@@ -61,7 +63,8 @@ public class TenantDatabaseUpgradeService {
|
|||||||
final FineractPlatformTenantConnection connection = tenant.getConnection();
|
final FineractPlatformTenantConnection connection = tenant.getConnection();
|
||||||
if (connection.isAutoUpdateEnabled()) {
|
if (connection.isAutoUpdateEnabled()) {
|
||||||
final Flyway flyway = new Flyway();
|
final Flyway flyway = new Flyway();
|
||||||
flyway.setDataSource(connection.databaseURL(), connection.getSchemaUsername(), connection.getSchemaPassword());
|
DriverDataSource source = new DriverDataSource(DRIVER_CLASS, connection.databaseURL(), connection.getSchemaUsername(), connection.getSchemaPassword()) ;
|
||||||
|
flyway.setDataSource(source);
|
||||||
flyway.setLocations("sql/migrations/core_db");
|
flyway.setLocations("sql/migrations/core_db");
|
||||||
flyway.setOutOfOrder(true);
|
flyway.setOutOfOrder(true);
|
||||||
try {
|
try {
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ public class TomcatJdbcDataSourcePerTenantService implements RoutingDataSourceSe
|
|||||||
|
|
||||||
final String jdbcUrl = tenantConnectionObj.databaseURL();
|
final String jdbcUrl = tenantConnectionObj.databaseURL();
|
||||||
final PoolConfiguration poolConfiguration = new PoolProperties();
|
final PoolConfiguration poolConfiguration = new PoolProperties();
|
||||||
poolConfiguration.setDriverClassName("com.mysql.jdbc.Driver");
|
poolConfiguration.setDriverClassName("org.drizzle.jdbc.DrizzleDriver");
|
||||||
poolConfiguration.setName(tenantConnectionObj.getSchemaName() + "_pool");
|
poolConfiguration.setName(tenantConnectionObj.getSchemaName() + "_pool");
|
||||||
poolConfiguration.setUrl(jdbcUrl);
|
poolConfiguration.setUrl(jdbcUrl);
|
||||||
poolConfiguration.setUsername(tenantConnectionObj.getSchemaUsername());
|
poolConfiguration.setUsername(tenantConnectionObj.getSchemaUsername());
|
||||||
|
|||||||
+3
-2
@@ -19,6 +19,7 @@
|
|||||||
package org.apache.fineract.portfolio.loanaccount.service;
|
package org.apache.fineract.portfolio.loanaccount.service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -333,8 +334,8 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
|||||||
|
|
||||||
private void updateSchheduleWithPaidDetail(Map<Long, List<LoanSchedulePeriodData>> scheduleDate, List<Map<String, Object>> loanSummary) {
|
private void updateSchheduleWithPaidDetail(Map<Long, List<LoanSchedulePeriodData>> scheduleDate, List<Map<String, Object>> loanSummary) {
|
||||||
for (Map<String, Object> transactionMap : loanSummary) {
|
for (Map<String, Object> transactionMap : loanSummary) {
|
||||||
Long loanId = (Long) transactionMap.get("loanId");
|
String longValue = transactionMap.get("loanId").toString() ; //From JDBC Template API, we are getting BigInteger but in other call, we are getting Long
|
||||||
|
Long loanId = Long.parseLong(longValue) ;
|
||||||
BigDecimal principalAmtPaid = (BigDecimal) transactionMap.get("principalAmtPaid");
|
BigDecimal principalAmtPaid = (BigDecimal) transactionMap.get("principalAmtPaid");
|
||||||
BigDecimal principalAmtWrittenoff = (BigDecimal) transactionMap.get("principalAmtWrittenoff");
|
BigDecimal principalAmtWrittenoff = (BigDecimal) transactionMap.get("principalAmtWrittenoff");
|
||||||
BigDecimal interestAmtPaid = (BigDecimal) transactionMap.get("interestAmtPaid");
|
BigDecimal interestAmtPaid = (BigDecimal) transactionMap.get("interestAmtPaid");
|
||||||
|
|||||||
@@ -1,2 +1,21 @@
|
|||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
spring.profiles.default=basicauth
|
spring.profiles.default=basicauth
|
||||||
+4
-3
@@ -31,7 +31,7 @@ ALTER TABLE `m_client`
|
|||||||
ADD CONSTRAINT `FK_m_client_m_image` FOREIGN KEY (`image_id`) REFERENCES `m_image` (`id`);
|
ADD CONSTRAINT `FK_m_client_m_image` FOREIGN KEY (`image_id`) REFERENCES `m_image` (`id`);
|
||||||
|
|
||||||
/*Move existing image locations to new table*/
|
/*Move existing image locations to new table*/
|
||||||
drop procedure if exists migrate_customer_image_data;
|
/*drop procedure if exists migrate_customer_image_data;
|
||||||
|
|
||||||
delimiter #
|
delimiter #
|
||||||
create procedure migrate_customer_image_data()
|
create procedure migrate_customer_image_data()
|
||||||
@@ -64,9 +64,10 @@ end#
|
|||||||
|
|
||||||
delimiter ;
|
delimiter ;
|
||||||
call migrate_customer_image_data();
|
call migrate_customer_image_data();
|
||||||
|
*/
|
||||||
|
|
||||||
/*Now drop the procedure*/
|
/*Now drop the procedure*/
|
||||||
drop procedure if exists migrate_customer_image_data;
|
/*drop procedure if exists migrate_customer_image_data; */
|
||||||
|
|
||||||
/*Delete image key from client*/
|
/*Delete image key from client*/
|
||||||
ALTER TABLE `m_client` DROP COLUMN `image_key`;
|
ALTER TABLE `m_client` DROP COLUMN `image_key`;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<Context>
|
<Context>
|
||||||
<Resource type="javax.sql.DataSource" name="jdbc/mifosplatform-tenants"
|
<Resource type="javax.sql.DataSource" name="jdbc/mifosplatform-tenants"
|
||||||
driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/mifosplatform-tenants"
|
driverClassName="org.drizzle.jdbc.DrizzleDriver" url="jdbc:mysql:thin://localhost:3306/mifosplatform-tenants"
|
||||||
username="root" password="mysql" validationQuery="select 1" maxActive="10"
|
username="root" password="mysql" validationQuery="select 1" maxActive="10"
|
||||||
maxIdle="4" />
|
maxIdle="4" />
|
||||||
</Context>
|
</Context>
|
||||||
Reference in New Issue
Block a user