diff --git a/mifosng-db/0002-mifosng-base-reference-data.sql b/mifosng-db/0002-mifosng-base-reference-data.sql index 79ace77f6..4ae10c315 100644 --- a/mifosng-db/0002-mifosng-base-reference-data.sql +++ b/mifosng-db/0002-mifosng-base-reference-data.sql @@ -39,7 +39,9 @@ VALUES (80,'LAK',2,NULL,'Lao Kip','currency.LAK'), (81,'LBP',2,'L£','Lebanese Pound','currency.LBP'), (82,'LKR',2,NULL,'Sri Lanka Rupee','currency.LKR'),(83,'LRD',2,NULL,'Liberian Dollar','currency.LRD'),(84,'LSL',2,NULL,'Lesotho Loti','currency.LSL'), -(85,'LTL',2,NULL,'Lithuanian Litas','currency.LTL'),(86,'LVL',2,NULL,'Latvian Lats','currency.LVL'),(87,'LYD',3,NULL,'Libyan Dinar','currency.LYD'),(88,'MAD',2,NULL,'Moroccan Dirham','currency.MAD'),(89,'MDL',2,NULL,'Moldovan Leu','currency.MDL'),(90,'MGA',2,NULL,'Malagasy Ariary','currency.MGA'),(91,'MKD',2,NULL,'Macedonian Denar','currency.MKD'),(92,'MMK',2,NULL,'Myanmar Kyat','currency.MMK'),(93,'MNT',2,NULL,'Mongolian Tugrik','currency.MNT'),(94,'MOP',2,NULL,'Macau Pataca','currency.MOP'),(95,'MRO',2,NULL,'Mauritania Ouguiya','currency.MRO'),(96,'MTL',2,NULL,'Maltese Lira','currency.MTL'),(97,'MUR',2,NULL,'Mauritius Rupee','currency.MUR'),(98,'MVR',2,NULL,'Maldives Rufiyaa','currency.MVR'),(99,'MWK',2,NULL,'Malawi Kwacha','currency.MWK'),(100,'MXN',2,NULL,'Mexican Peso','currency.MXN'),(101,'MYR',2,NULL,'Malaysian Ringgit','currency.MYR'),(102,'MZM',2,NULL,'Mozambique Metical','currency.MZM'),(103,'NAD',2,NULL,'Namibia Dollar','currency.NAD'),(104,'NGN',2,NULL,'Nigerian Naira','currency.NGN'),(105,'NIO',2,NULL,'Nicaragua Cordoba Oro','currency.NIO'),(106,'NOK',2,NULL,'Norwegian Krone','currency.NOK'),(107,'NPR',2,NULL,'Nepalese Rupee','currency.NPR'),(108,'NZD',2,NULL,'New Zealand Dollar','currency.NZD'),(109,'OMR',3,NULL,'Rial Omani','currency.OMR'),(110,'PAB',2,NULL,'Panama Balboa','currency.PAB'),(111,'PEN',2,NULL,'Peruvian Nuevo Sol','currency.PEN'),(112,'PGK',2,NULL,'Papua New Guinea Kina','currency.PGK'),(113,'PHP',2,NULL,'Philippine Peso','currency.PHP'),(114,'PKR',2,NULL,'Pakistan Rupee','currency.PKR'),(115,'PLN',2,NULL,'Polish Zloty','currency.PLN'),(116,'PYG',0,NULL,'Paraguayan Guarani','currency.PYG'),(117,'QAR',2,NULL,'Qatari Rial','currency.QAR'), +(85,'LTL',2,NULL,'Lithuanian Litas','currency.LTL'),(86,'LVL',2,NULL,'Latvian Lats','currency.LVL'),(87,'LYD',3,NULL,'Libyan Dinar','currency.LYD'),(88,'MAD',2,NULL,'Moroccan Dirham','currency.MAD'),(89,'MDL',2,NULL,'Moldovan Leu','currency.MDL'),(90,'MGA',2,NULL,'Malagasy Ariary','currency.MGA'),(91,'MKD',2,NULL,'Macedonian Denar','currency.MKD'), +(92,'MMK',2,'K','Myanmar Kyat','currency.MMK'), +(93,'MNT',2,NULL,'Mongolian Tugrik','currency.MNT'),(94,'MOP',2,NULL,'Macau Pataca','currency.MOP'),(95,'MRO',2,NULL,'Mauritania Ouguiya','currency.MRO'),(96,'MTL',2,NULL,'Maltese Lira','currency.MTL'),(97,'MUR',2,NULL,'Mauritius Rupee','currency.MUR'),(98,'MVR',2,NULL,'Maldives Rufiyaa','currency.MVR'),(99,'MWK',2,NULL,'Malawi Kwacha','currency.MWK'),(100,'MXN',2,NULL,'Mexican Peso','currency.MXN'),(101,'MYR',2,NULL,'Malaysian Ringgit','currency.MYR'),(102,'MZM',2,NULL,'Mozambique Metical','currency.MZM'),(103,'NAD',2,NULL,'Namibia Dollar','currency.NAD'),(104,'NGN',2,NULL,'Nigerian Naira','currency.NGN'),(105,'NIO',2,NULL,'Nicaragua Cordoba Oro','currency.NIO'),(106,'NOK',2,NULL,'Norwegian Krone','currency.NOK'),(107,'NPR',2,NULL,'Nepalese Rupee','currency.NPR'),(108,'NZD',2,NULL,'New Zealand Dollar','currency.NZD'),(109,'OMR',3,NULL,'Rial Omani','currency.OMR'),(110,'PAB',2,NULL,'Panama Balboa','currency.PAB'),(111,'PEN',2,NULL,'Peruvian Nuevo Sol','currency.PEN'),(112,'PGK',2,NULL,'Papua New Guinea Kina','currency.PGK'),(113,'PHP',2,NULL,'Philippine Peso','currency.PHP'),(114,'PKR',2,NULL,'Pakistan Rupee','currency.PKR'),(115,'PLN',2,NULL,'Polish Zloty','currency.PLN'),(116,'PYG',0,NULL,'Paraguayan Guarani','currency.PYG'),(117,'QAR',2,NULL,'Qatari Rial','currency.QAR'), (118,'RON',2,NULL,'Romanian Leu','currency.RON'),(119,'RUB',2,NULL,'Russian Ruble','currency.RUB'),(120,'RWF',0,NULL,'Rwanda Franc','currency.RWF'),(121,'SAR',2,NULL,'Saudi Riyal','currency.SAR'),(122,'SBD',2,NULL,'Solomon Islands Dollar','currency.SBD'),(123,'SCR',2,NULL,'Seychelles Rupee','currency.SCR'),(124,'SDD',2,NULL,'Sudanese Dinar','currency.SDD'),(125,'SEK',2,NULL,'Swedish Krona','currency.SEK'),(126,'SGD',2,NULL,'Singapore Dollar','currency.SGD'),(127,'SHP',2,NULL,'St Helena Pound','currency.SHP'),(128,'SIT',2,NULL,'Slovenian Tolar','currency.SIT'),(129,'SKK',2,NULL,'Slovak Koruna','currency.SKK'),(130,'SLL',2,NULL,'Sierra Leone Leone','currency.SLL'),(131,'SOS',2,NULL,'Somali Shilling','currency.SOS'),(132,'SRD',2,NULL,'Surinam Dollar','currency.SRD'), (133,'STD',2,NULL,'Sao Tome and Principe Dobra','currency.STD'),(134,'SVC',2,NULL,'El Salvador Colon','currency.SVC'),(135,'SYP',2,NULL,'Syrian Pound','currency.SYP'),(136,'SZL',2,NULL,'Swaziland Lilangeni','currency.SZL'),(137,'THB',2,NULL,'Thai Baht','currency.THB'), (138,'TJS',2,NULL,'Tajik Somoni','currency.TJS'),(139,'TMM',2,NULL,'Turkmenistan Manat','currency.TMM'), diff --git a/mifosng-db/multi-tenant-demo-backups/0001-mifos-platform-shared-tenants.sql b/mifosng-db/multi-tenant-demo-backups/0001-mifos-platform-shared-tenants.sql index 58da557ae..c4d3b0e33 100644 --- a/mifosng-db/multi-tenant-demo-backups/0001-mifos-platform-shared-tenants.sql +++ b/mifosng-db/multi-tenant-demo-backups/0001-mifos-platform-shared-tenants.sql @@ -5,6 +5,10 @@ CREATE TABLE `mifosplatform-tenants`.`tenants` ( `identifier` varchar(100) NOT NULL, `name` varchar(100) NOT NULL, `schema_name` varchar(100) NOT NULL, + `schema_server` varchar(100) NOT NULL DEFAULT 'localhost', + `schema_server_port` varchar(10) NOT NULL DEFAULT '3306', + `schema_username` varchar(100) NOT NULL DEFAULT 'root', + `schema_password` varchar(100) NOT NULL DEFAULT 'mysql', `timezone_id` int(11) DEFAULT NULL, `country_id` int(11) DEFAULT NULL, `joined_date` date DEFAULT NULL, diff --git a/mifosng-db/patches-beta-3-heavens-family/patch-0001-fund-and-loanproduct-changes.sql b/mifosng-db/patches-beta-3-heavens-family/patch-0001-fund-and-loanproduct-changes.sql deleted file mode 100644 index c97091a54..000000000 --- a/mifosng-db/patches-beta-3-heavens-family/patch-0001-fund-and-loanproduct-changes.sql +++ /dev/null @@ -1,33 +0,0 @@ --- create fund table -DROP TABLE IF EXISTS `org_fund`; -CREATE TABLE `org_fund` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `org_id` bigint(20) NOT NULL, - `name` varchar(255) DEFAULT NULL, - `external_id` varchar(100) DEFAULT NULL, - `createdby_id` bigint(20) DEFAULT NULL, - `created_date` datetime DEFAULT NULL, - `lastmodifiedby_id` bigint(20) DEFAULT NULL, - `lastmodified_date` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `fund_name_org` (`org_id`,`name`), - UNIQUE KEY `fund_externalid_org` (`org_id`,`external_id`), - KEY `FK4E56DB40541F0A56` (`createdby_id`), - KEY `FK4E56DB4054DF2770` (`org_id`), - KEY `FK4E56DB408F889C3F` (`lastmodifiedby_id`), - CONSTRAINT `FK4E56DB408F889C3F` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `admin_appuser` (`id`), - CONSTRAINT `FK4E56DB40541F0A56` FOREIGN KEY (`createdby_id`) REFERENCES `admin_appuser` (`id`), - CONSTRAINT `FK4E56DB4054DF2770` FOREIGN KEY (`org_id`) REFERENCES `org_organisation` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; - --- example of dropping fund column/index/foreign key --- alter table `portfolio_product_loan` --- DROP FOREIGN KEY `FKA6A8A7D77240145`, --- DROP INDEX `FKA6A8A7D77240145`, --- drop column `fund_id`; - --- associate fund table with loan products making it fund optional at database level -alter table `portfolio_product_loan` -add column `fund_id` bigint(20) DEFAULT NULL, -add KEY `FKA6A8A7D77240145` (`fund_id`), -add CONSTRAINT `FKA6A8A7D77240145` FOREIGN KEY (`fund_id`) REFERENCES `org_fund` (`id`); \ No newline at end of file diff --git a/mifosng-db/patches-beta-3-heavens-family/patch-0002-fund-and-loan-changes.sql b/mifosng-db/patches-beta-3-heavens-family/patch-0002-fund-and-loan-changes.sql deleted file mode 100644 index e2ad91e09..000000000 --- a/mifosng-db/patches-beta-3-heavens-family/patch-0002-fund-and-loan-changes.sql +++ /dev/null @@ -1,11 +0,0 @@ --- example of dropping fund column/index/foreign key --- alter table `portfolio_loan` --- DROP FOREIGN KEY `FK7C885877240145`, --- DROP INDEX `FK7C885877240145`, --- drop column `fund_id`; - --- associate fund table with loans making fund optional at database level -alter table `portfolio_loan` -add column `fund_id` bigint(20) DEFAULT NULL, -add KEY `FK7C885877240145` (`fund_id`), -add CONSTRAINT `FK7C885877240145` FOREIGN KEY (`fund_id`) REFERENCES `org_fund` (`id`); \ No newline at end of file diff --git a/mifosng-db/patches-beta-3-heavens-family/patch-0005-branch-transfer-of-funds.sql b/mifosng-db/patches-beta-3-heavens-family/patch-0005-branch-transfer-of-funds.sql deleted file mode 100644 index 8c4e176fc..000000000 --- a/mifosng-db/patches-beta-3-heavens-family/patch-0005-branch-transfer-of-funds.sql +++ /dev/null @@ -1,20 +0,0 @@ --- create fund table -DROP TABLE IF EXISTS `portfolio_office_monetary_transfers`; -CREATE TABLE `portfolio_office_monetary_transfers` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `from_office_id` bigint(20) DEFAULT NULL, - `to_office_id` bigint(20) DEFAULT NULL, - `currency_code` varchar(3) NOT NULL, - `currency_digits` int(11) NOT NULL, - `transaction_amount` decimal(19,6) NOT NULL, - `transaction_date` date NOT NULL, - `created_date` datetime DEFAULT NULL, - `createdby_id` bigint(20) DEFAULT NULL, - `lastmodified_date` datetime DEFAULT NULL, - `lastmodifiedby_id` bigint(20) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `FK1E37728B93C6C1B6` (`to_office_id`), - KEY `FK1E37728B783C5C25` (`from_office_id`), - CONSTRAINT `FK1E37728B783C5C25` FOREIGN KEY (`from_office_id`) REFERENCES `org_office` (`id`), - CONSTRAINT `FK1E37728B93C6C1B6` FOREIGN KEY (`to_office_id`) REFERENCES `org_office` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/mifosng-db/patches-beta-3-heavens-family/patch-0006-office-transactions.sql b/mifosng-db/patches-beta-3-heavens-family/patch-0006-office-transactions.sql deleted file mode 100644 index 4b4a05717..000000000 --- a/mifosng-db/patches-beta-3-heavens-family/patch-0006-office-transactions.sql +++ /dev/null @@ -1,22 +0,0 @@ --- create office transaction table -DROP TABLE IF EXISTS `portfolio_office_monetary_transfers`; -DROP TABLE IF EXISTS `portfolio_office_transaction`; -CREATE TABLE `portfolio_office_transaction` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `from_office_id` bigint(20) DEFAULT NULL, - `to_office_id` bigint(20) DEFAULT NULL, - `currency_code` varchar(3) NOT NULL, - `currency_digits` int(11) NOT NULL, - `transaction_amount` decimal(19,6) NOT NULL, - `transaction_date` date NOT NULL, - `description` varchar(100) DEFAULT NULL, - `created_date` datetime DEFAULT NULL, - `createdby_id` bigint(20) DEFAULT NULL, - `lastmodified_date` datetime DEFAULT NULL, - `lastmodifiedby_id` bigint(20) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `FK1E37728B93C6C1B6` (`to_office_id`), - KEY `FK1E37728B783C5C25` (`from_office_id`), - CONSTRAINT `FK1E37728B783C5C25` FOREIGN KEY (`from_office_id`) REFERENCES `org_office` (`id`), - CONSTRAINT `FK1E37728B93C6C1B6` FOREIGN KEY (`to_office_id`) REFERENCES `org_office` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/mifosng-db/patches-beta-3-heavens-family/patch-0007-remove-organisations.sql b/mifosng-db/patches-beta-3-heavens-family/patch-0007-remove-organisations.sql deleted file mode 100644 index cc566744d..000000000 --- a/mifosng-db/patches-beta-3-heavens-family/patch-0007-remove-organisations.sql +++ /dev/null @@ -1,55 +0,0 @@ -/* remove column org_id */ - -ALTER TABLE `org_office` DROP FOREIGN KEY `FK2291C47754DF2770`; -ALTER TABLE `org_office` DROP COLUMN `org_id`, -DROP INDEX `name_org`, -ADD UNIQUE INDEX `name_org` (`name` ASC), -DROP INDEX `externalid_org`, -ADD UNIQUE INDEX `externalid_org` (`external_id` ASC), -DROP INDEX `FK2291C47754DF2770`; - -ALTER TABLE `portfolio_client` DROP FOREIGN KEY `FKCE00CAB354DF2770`; -ALTER TABLE `portfolio_client` - DROP COLUMN `org_id` , - DROP INDEX `org_id` , - ADD UNIQUE INDEX `external_id` (`external_id` ASC) , - DROP INDEX `FKCE00CAB354DF2770`; - -ALTER TABLE `portfolio_client` - DROP INDEX `external_id`, - ADD UNIQUE INDEX `external_id` (`external_id` ASC); - - -ALTER TABLE `org_fund` DROP FOREIGN KEY `FK4E56DB4054DF2770` ; -ALTER TABLE `org_fund` DROP COLUMN `org_id` , DROP INDEX `fund_name_org` , ADD UNIQUE INDEX `fund_name_org` (`name` ASC) , DROP INDEX `fund_externalid_org` , ADD UNIQUE INDEX `fund_externalid_org` (`external_id` ASC) , DROP INDEX `FK4E56DB4054DF2770` ; - -ALTER TABLE `org_organisation_currency` DROP FOREIGN KEY `FK308062BB54DF2770` ;ALTER TABLE `org_organisation_currency` DROP COLUMN `org_id` , DROP INDEX `FK308062BB54DF2770` ; - -ALTER TABLE `admin_appuser` DROP FOREIGN KEY `FKB3D587C54DF2770` ;ALTER TABLE `admin_appuser` DROP COLUMN `org_id` , DROP INDEX `username_org` , ADD UNIQUE INDEX `username_org` (`username` ASC) , DROP INDEX `FKB3D587C54DF2770` ; - -ALTER TABLE `admin_permission` DROP FOREIGN KEY `FK18040BF54DF2770` ;ALTER TABLE `admin_permission` DROP COLUMN `org_id` , DROP INDEX `FK18040BF54DF2770` ; - -ALTER TABLE `admin_role` DROP FOREIGN KEY `FK2902EF6654DF2770` ;ALTER TABLE `admin_role` DROP COLUMN `org_id` , DROP INDEX `FK2902EF6654DF2770`; - -ALTER TABLE `portfolio_loan` DROP FOREIGN KEY `FKB6F935D854DF2770` ;ALTER TABLE `portfolio_loan` DROP COLUMN `org_id` , DROP INDEX `org_id` , ADD UNIQUE INDEX `org_id` (`external_id` ASC) , DROP INDEX `FKB6F935D854DF2770` ; - -ALTER TABLE `portfolio_loan_repayment_schedule` DROP COLUMN `org_id`; - -ALTER TABLE `portfolio_loan_transaction` DROP COLUMN `org_id`; - -ALTER TABLE `portfolio_note` DROP FOREIGN KEY `FK7C9708954DF2770` ;ALTER TABLE `portfolio_note` DROP COLUMN `org_id` , DROP INDEX `FK7C9708954DF2770`; - -ALTER TABLE `portfolio_product_loan` DROP FOREIGN KEY `FK1BD0772854DF2770` ;ALTER TABLE `portfolio_product_loan` DROP COLUMN `org_id` , DROP INDEX `FK1BD0772854DF2770`; - -drop table `admin_oauth_consumer_application`; - -drop table `org_organisation`; - - - - - - - - - diff --git a/mifosng-db/patches-post-multi-tenant/patch-0001-myanmar-currency-display-symbol.sql b/mifosng-db/patches-post-multi-tenant/patch-0001-myanmar-currency-display-symbol.sql new file mode 100644 index 000000000..35f728db0 --- /dev/null +++ b/mifosng-db/patches-post-multi-tenant/patch-0001-myanmar-currency-display-symbol.sql @@ -0,0 +1,5 @@ +-- update display symbol for myanmar kyat. + +UPDATE `ref_currency` SET `display_symbol` = 'K' WHERE id=92; + +UPDATE `org_organisation_currency` SET `display_symbol` = 'K' WHERE id=92; diff --git a/mifosng-db/patches-post-multi-tenant/patch-0002-add-tenant-database-specific-config-columns.sql b/mifosng-db/patches-post-multi-tenant/patch-0002-add-tenant-database-specific-config-columns.sql new file mode 100644 index 000000000..7bd5741e6 --- /dev/null +++ b/mifosng-db/patches-post-multi-tenant/patch-0002-add-tenant-database-specific-config-columns.sql @@ -0,0 +1,13 @@ +-- add extra columns to externalise hard-coded tenant information + +ALTER TABLE `mifosplatform-tenants`.`tenants` +ADD COLUMN `schema_server` varchar(100) NOT NULL DEFAULT 'localhost'; + +ALTER TABLE `mifosplatform-tenants`.`tenants` +ADD COLUMN `schema_server_port` varchar(10) NOT NULL DEFAULT '3306'; + +ALTER TABLE `mifosplatform-tenants`.`tenants` +ADD COLUMN `schema_username` varchar(100) NOT NULL DEFAULT 'root'; + +ALTER TABLE `mifosplatform-tenants`.`tenants` +ADD COLUMN `schema_password` varchar(100) NOT NULL DEFAULT 'mysql'; diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/JdbcTenantDetailsService.java b/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/JdbcTenantDetailsService.java index 9e59cffea..56b18cfec 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/JdbcTenantDetailsService.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/JdbcTenantDetailsService.java @@ -27,7 +27,9 @@ public class JdbcTenantDetailsService implements TenantDetailsService { try { TenantMapper rm = new TenantMapper(); - String sql = "select id, name, schema_name as schemaName from tenants t where t.identifier like ?"; + String sql = "select id, name, schema_name as schemaName, schema_server as schemaServer, schema_server_port as schemaServerPort, " + + " schema_username as schemaUsername, schema_password as schemaPassword " + + " from tenants t where t.identifier like ?"; return this.jdbcTemplate.queryForObject(sql, rm, new Object[] {tenantIdentifier}); } catch (EmptyResultDataAccessException e) { @@ -43,8 +45,12 @@ public class JdbcTenantDetailsService implements TenantDetailsService { Long id = rs.getLong("id"); String name = rs.getString("name"); String schemaName = rs.getString("schemaName"); + String schemaServer = rs.getString("schemaServer"); + String schemaServerPort = rs.getString("schemaServerPort"); + String schemaUsername = rs.getString("schemaUsername"); + String schemaPassword = rs.getString("schemaPassword"); - return new MifosPlatformTenant(id, name, schemaName); + return new MifosPlatformTenant(id, name, schemaName, schemaServer, schemaServerPort, schemaUsername, schemaPassword); } } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/MifosPlatformTenant.java b/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/MifosPlatformTenant.java index d2306aa48..4a4729409 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/MifosPlatformTenant.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/MifosPlatformTenant.java @@ -5,11 +5,20 @@ public class MifosPlatformTenant { private final Long id; private final String name; private final String schemaName; + private final String schemaServer; + private final String schemaServerPort; + private final String schemaUsername; + private final String schemaPassword; - public MifosPlatformTenant(Long id, String name, String schemaName) { + public MifosPlatformTenant(final Long id, final String name, final String schemaName, + final String schemaServer, final String schemaServerPort, final String schemaUsername, final String schemaPassword) { this.id = id; this.name = name; this.schemaName = schemaName; + this.schemaServer = schemaServer; + this.schemaServerPort = schemaServerPort; + this.schemaUsername = schemaUsername; + this.schemaPassword = schemaPassword; } public Long getId() { @@ -23,4 +32,20 @@ public class MifosPlatformTenant { public String getSchemaName() { return schemaName; } -} + + public String getSchemaServer() { + return schemaServer; + } + + public String getSchemaServerPort() { + return schemaServerPort; + } + + public String getSchemaUsername() { + return schemaUsername; + } + + public String getSchemaPassword() { + return schemaPassword; + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/TomcatJdbcDataSourcePerTenantService.java b/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/TomcatJdbcDataSourcePerTenantService.java index 6dd05eeb3..4661ab485 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/TomcatJdbcDataSourcePerTenantService.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/infrastructure/TomcatJdbcDataSourcePerTenantService.java @@ -47,12 +47,20 @@ public class TomcatJdbcDataSourcePerTenantService implements DataSourcePerTenant private DataSource createNewDataSourceFor(final MifosPlatformTenant tenant) { // see http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency + + StringBuilder jdbcUrlBuilder = new StringBuilder("jdbc:mysql://") + .append(tenant.getSchemaServer()) + .append(':') + .append(tenant.getSchemaServerPort()) + .append('/') + .append(tenant.getSchemaName()); + PoolConfiguration poolConfiguration = new PoolProperties(); poolConfiguration.setDriverClassName("com.mysql.jdbc.Driver"); poolConfiguration.setName(tenant.getSchemaName() + "_pool"); - poolConfiguration.setUrl("jdbc:mysql://localhost:3306/" + tenant.getSchemaName()); - poolConfiguration.setUsername("root"); - poolConfiguration.setPassword("mysql"); + poolConfiguration.setUrl(jdbcUrlBuilder.toString()); + poolConfiguration.setUsername(tenant.getSchemaUsername()); + poolConfiguration.setPassword(tenant.getSchemaPassword()); poolConfiguration.setInitialSize(5); poolConfiguration.setMaxActive(5);