diff --git a/pom.xml b/pom.xml
index 6b049be..996d1f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -225,71 +225,12 @@
runtime
-
-
-
-
commons-pool
commons-pool
1.6
-
-
-
- mysql
- mysql-connector-java
- 5.1.37
-
-
-
-
- org.postgresql
- postgresql
- 9.4-1201-jdbc41
-
-
-
-
- org.hsqldb
- hsqldb
- 2.2.6
-
-
-
-
- driver.oracle
- driver
- 7.0
-
-
-
-
- driver.teradata.driver
- terajdbc4
- 1.0
-
-
-
- driver.teradata.driver
- tdgssconfig
- 1.0
-
-
-
-
- com.microsoft.sqlserver
- sqljdbc4
- 4.0
-
-
-
-
- net.sf.ucanaccess
- ucanaccess
- 3.0.3.1
-
-
+
junit
junit
diff --git a/src/main/java/es/imim/ibi/comorbidity4j/server/spring/contr/DiagnosisGroupingAndPairing.java b/src/main/java/es/imim/ibi/comorbidity4j/server/spring/contr/DiagnosisGroupingAndPairing.java
index c2f63cd..a5eb163 100644
--- a/src/main/java/es/imim/ibi/comorbidity4j/server/spring/contr/DiagnosisGroupingAndPairing.java
+++ b/src/main/java/es/imim/ibi/comorbidity4j/server/spring/contr/DiagnosisGroupingAndPairing.java
@@ -1,6 +1,5 @@
package es.imim.ibi.comorbidity4j.server.spring.contr;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
@@ -15,9 +14,8 @@
import javax.servlet.http.HttpServletRequest;
-import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.util.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/es/imim/ibi/comorbidity4j/server/spring/contr/PatientDataValidation.java b/src/main/java/es/imim/ibi/comorbidity4j/server/spring/contr/PatientDataValidation.java
index 7d2f535..7259e1e 100644
--- a/src/main/java/es/imim/ibi/comorbidity4j/server/spring/contr/PatientDataValidation.java
+++ b/src/main/java/es/imim/ibi/comorbidity4j/server/spring/contr/PatientDataValidation.java
@@ -24,7 +24,7 @@
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.logging.log4j.util.Strings;
import org.slf4j.Logger;
diff --git a/src/main/java/es/imim/ibi/omop/db/DBConnector.java b/src/main/java/es/imim/ibi/omop/db/DBConnector.java
deleted file mode 100644
index 0bc63b8..0000000
--- a/src/main/java/es/imim/ibi/omop/db/DBConnector.java
+++ /dev/null
@@ -1,197 +0,0 @@
-package es.imim.ibi.omop.db;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-
-import oracle.jdbc.pool.OracleDataSource;
-
-/**
- * Instantiate connections to different relational DBs.
- *
- */
-public class DBConnector {
-
- public static Connection connect(String server, String domain, String user, String password, DbType dbType) {
- if (dbType.equals(DbType.MYSQL))
- return DBConnector.connectToMySQL(server, user, password);
- else if (dbType.equals(DbType.MSSQL) || dbType.equals(DbType.PDW))
- return DBConnector.connectToMSSQL(server, domain, user, password);
- else if (dbType.equals(DbType.ORACLE))
- return DBConnector.connectToOracle(server, domain, user, password);
- else if (dbType.equals(DbType.POSTGRESQL))
- return DBConnector.connectToPostgreSQL(server, user, password);
- else if (dbType.equals(DbType.MSACCESS))
- return DBConnector.connectToMsAccess(server, user, password);
- else if (dbType.equals(DbType.REDSHIFT))
- return DBConnector.connectToRedshift(server, user, password);
- else if (dbType.equals(DbType.TERADATA))
- return DBConnector.connectToTeradata(server, user, password);
- else
- return null;
- }
-
- public static Connection connectToTeradata(String server, String user, String password) {
- try {
- Class.forName("com.teradata.jdbc.TeraDriver");
- } catch(ClassNotFoundException e) {
- throw new RuntimeException("Cannot find JDBC driver. Make sure the terajdbc4.jar and tdgssconfig.jar are in the path");
- }
- String url = "jdbc:teradata://" + server;
- try {
- return DriverManager.getConnection(url, user, password);
- } catch (SQLException e1) {
- throw new RuntimeException("Cannot connect to DB server: " + e1.getMessage());
- }
- }
-
- public static Connection connectToRedshift(String server, String user, String password) {
- if (!server.contains("/"))
- throw new RuntimeException("For Redshift, database name must be specified in the server field (:/?)");
- try {
- Class.forName("com.amazon.redshift.jdbc4.Driver");
- } catch (ClassNotFoundException e1) {
- throw new RuntimeException("Cannot find JDBC driver. Make sure the file RedshiftJDBCx-x.x.xx.xxxx.jar is in the path");
- }
- String url = "jdbc:redshift://" + server;
- try {
- return DriverManager.getConnection(url, user, password);
- } catch (SQLException e1) {
- throw new RuntimeException("Cannot connect to DB server: " + e1.getMessage());
- }
- }
-
- public static Connection connectToMsAccess(String server, String user, String password) {
- try {
- Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Cannot find ucanaccess driver. Make sure the file ucanaccess-3.0.3.1.jar is in the path");
- }
- String url = "jdbc:ucanaccess://" + server + ";sysschema=true";
- try {
- return DriverManager.getConnection(url, user, password);
- } catch (SQLException e) {
- throw new RuntimeException("Cannot connect to DB server: " + e.getMessage());
- }
- }
-
- public static Connection connectToPostgreSQL(String server, String user, String password) {
- if (!server.contains("/"))
- throw new RuntimeException("For PostgreSQL, database name must be specified in the server field (/)");
- if (!server.contains(":"))
- server = server.replace("/", ":5432/");
- try {
- Class.forName("org.postgresql.Driver");
- } catch (ClassNotFoundException e1) {
- throw new RuntimeException("Cannot find JDBC driver. Make sure the file postgresql-x.x-xxxx.jdbcx.jar is in the path");
- }
- String url = "jdbc:postgresql://" + server;
- try {
- return DriverManager.getConnection(url, user, password);
- } catch (SQLException e1) {
- throw new RuntimeException("Cannot connect to DB server: " + e1.getMessage());
- }
- }
-
- public static Connection connectToMySQL(String server, String user, String password) {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- } catch (ClassNotFoundException e1) {
- throw new RuntimeException("Cannot find JDBC driver. Make sure the file mysql-connector-java-x.x.xx-bin.jar is in the path");
- }
-
- String url = "jdbc:mysql://" + server + ":3306/?useCursorFetch=true&zeroDateTimeBehavior=convertToNull";
-
- try {
- return DriverManager.getConnection(url, user, password);
- } catch (SQLException e1) {
- throw new RuntimeException("Cannot connect to DB server: " + e1.getMessage());
- }
- }
-
- public static Connection connectToODBC(String server, String user, String password) {
- try {
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- } catch (ClassNotFoundException e1) {
- throw new RuntimeException("Cannot find ODBC driver");
- }
-
- String url = "jdbc:odbc:" + server;
-
- try {
- Connection connection = DriverManager.getConnection(url, user, password);
-
- return connection;
- } catch (SQLException e1) {
- throw new RuntimeException("Cannot connect to DB server: " + e1.getMessage());
- }
- }
-
- public static Connection connectToMSSQL(String server, String domain, String user, String password) {
- try {
- Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
- } catch (ClassNotFoundException e1) {
- throw new RuntimeException("Cannot find JDBC driver. Make sure the file sqljdbc4.jar is in the path");
- }
- String url = "jdbc:sqlserver://" + server;
- if (user == null || user.length() == 0) { // Use Windows integrated security
- url = url + ";integratedSecurity=true";
- }
- try {
- return DriverManager.getConnection(url, user, password);
- } catch (SQLException e1) {
- throw new RuntimeException("Cannot connect to DB server: " + e1.getMessage());
- }
- }
-
- public static Connection connectToOracle(String server, String domain, String user, String password) {
- try {
- Class.forName("oracle.jdbc.driver.OracleDriver");
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Class not found exception: " + e.getMessage());
- }
- // First try OCI driver:
- String error = null;
- try {
- OracleDataSource ods;
- ods = new OracleDataSource();
- ods.setURL("jdbc:oracle:oci8:@" + server);
- ods.setUser(user);
- ods.setPassword(password);
- return ods.getConnection();
- } catch (UnsatisfiedLinkError e) {
- error = e.getMessage();
- } catch (SQLException e) {
- error = e.getMessage();
- }
- // If fails, try THIN driver:
- if (error != null)
- try {
- String host = "127.0.0.1";
- String sid = server;
- String port = "1521";
- if (server.contains("/")) {
- host = server.split("/")[0];
- if (host.contains(":")) {
- port = host.split(":")[1];
- host = host.split(":")[0];
- }
- sid = server.split("/")[1];
- }
- OracleDataSource ods;
- ods = new OracleDataSource();
- ods.setURL("jdbc:oracle:thin:@" + host + ":" + port + ":" + sid);
- ods.setUser(user);
- ods.setPassword(password);
- return ods.getConnection();
- } catch (SQLException e) {
- throw new RuntimeException("Cannot connect to DB server:\n- When using OCI: " + error + "\n- When using THIN: " + e.getMessage());
- }
- return null;
- }
-
- public static void main(String[] args) {
-
-
- }
-}
diff --git a/src/main/java/es/imim/ibi/omop/db/DbType.java b/src/main/java/es/imim/ibi/omop/db/DbType.java
deleted file mode 100644
index 13947c2..0000000
--- a/src/main/java/es/imim/ibi/omop/db/DbType.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package es.imim.ibi.omop.db;
-
-public class DbType {
- public static DbType MYSQL = new DbType("mysql");
- public static DbType MSSQL = new DbType("mssql");
- public static DbType PDW = new DbType("pdw");
- public static DbType ORACLE = new DbType("oracle");
- public static DbType POSTGRESQL = new DbType("postgresql");
- public static DbType MSACCESS = new DbType("msaccess");
- public static DbType REDSHIFT = new DbType("redshift");
- public static DbType TERADATA = new DbType("teradata");
-
- private enum Type {
- MYSQL, MSSQL, PDW, ORACLE, POSTGRESQL, MSACCESS, REDSHIFT, TERADATA
- };
-
- private Type type;
-
- public DbType(String type) {
- this.type = Type.valueOf(type.toUpperCase());
- }
-
- public boolean equals(Object other) {
- if (other instanceof DbType && ((DbType) other).type == type)
- return true;
- else
- return false;
- }
-}
diff --git a/src/main/java/es/imim/ibi/omop/db/RichConnection.java b/src/main/java/es/imim/ibi/omop/db/RichConnection.java
deleted file mode 100644
index dadbb9f..0000000
--- a/src/main/java/es/imim/ibi/omop/db/RichConnection.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package es.imim.ibi.omop.db;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import es.imim.ibi.comorbidity4j.analysis.ComorbidityMiner;
-
-public class RichConnection {
-
- private static final Logger logger = LoggerFactory.getLogger(ComorbidityMiner.class);
-
- private Connection connection;
- private boolean verbose = false;
- private DbType dbType;
-
- public RichConnection(String server, String domain, String user, String password, DbType dbType) {
- this.connection = DBConnector.connect(server, domain, user, password, dbType);
- this.dbType = dbType;
- }
-
- /**
- * Execute the given SQL statement.
- *
- * @param sql
- */
- public ResultSet executeReadQuery(String sql) throws SQLException {
- Statement stmt = null;
-
- try {
- stmt = connection.createStatement();
- ResultSet rs = stmt.executeQuery(sql);
- return rs;
- } catch (SQLException e ) {
- logger.error("Exception while executing query " + ((sql != null) ? sql : "NULL") + " - " + e.getMessage());
- if(this.verbose) {
- e.printStackTrace();
- }
- } finally {
- if (stmt != null) { stmt.close(); }
- }
-
- return null;
- }
-
- /**
- * Close the connection to the database.
- */
- public void close() {
- try {
- connection.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Check verbose output
- *
- * @return
- */
- public boolean isVerbose() {
- return verbose;
- }
-
- /**
- * Set verbose output
- *
- * @param verbose
- */
- public void setVerbose(boolean verbose) {
- this.verbose = verbose;
- }
-
-
-}
diff --git a/src/test/java/es/imim/ibi/comorbidity4j/utest/ComorbidityValuesTest.java b/src/test/java/es/imim/ibi/comorbidity4j/utest/ComorbidityValuesTest.java
index 27df66c..1c95e8a 100644
--- a/src/test/java/es/imim/ibi/comorbidity4j/utest/ComorbidityValuesTest.java
+++ b/src/test/java/es/imim/ibi/comorbidity4j/utest/ComorbidityValuesTest.java
@@ -9,7 +9,7 @@
import java.text.DecimalFormat;
import java.util.Collection;
-import org.apache.commons.lang.math.NumberUtils;
+import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.logging.log4j.util.Strings;