Commit 7698d9d7 authored by Julian Zobel's avatar Julian Zobel
Browse files

Database Output: Did not include port and database location (hard-coded...

Database Output: Did not include port and database location (hard-coded localhost). Added the port and address setting as option to the Output Class and include it in the JDBC connection setup.
parent 40a16a77
...@@ -68,6 +68,14 @@ public class MetricOutputDAO extends AbstractOutput { ...@@ -68,6 +68,14 @@ public class MetricOutputDAO extends AbstractOutput {
DAO.database = table; DAO.database = table;
} }
public void setAddress(String address) {
DAO.address = address;
}
public void setPort(String port) {
DAO.port = port;
}
public void setUser(String user) { public void setUser(String user) {
DAO.username = user; DAO.username = user;
} }
......
...@@ -92,11 +92,15 @@ public class DAO { ...@@ -92,11 +92,15 @@ public class DAO {
private static ArrayList<Class<?>> daoClasses = new ArrayList<Class<?>>(); private static ArrayList<Class<?>> daoClasses = new ArrayList<Class<?>>();
public static String address = "localhost";
public static String port = "3306";
public static String database; public static String database;
public static String username; public static String username;
public static String password; public static String password;
private static SessionFactory sessionFactory; private static SessionFactory sessionFactory;
...@@ -122,7 +126,7 @@ public class DAO { ...@@ -122,7 +126,7 @@ public class DAO {
cfg.setProperty("hibernate.format_sql", "false"); cfg.setProperty("hibernate.format_sql", "false");
cfg.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver"); cfg.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
// Default user/pass/database, overwrite using MetricOutputDAO // Default user/pass/database, overwrite using MetricOutputDAO
cfg.setProperty("hibernate.connection.url", "jdbc:mysql://localhost/"+database); cfg.setProperty("hibernate.connection.url", "jdbc:mysql://"+ address + ":" + port + "/" + database);
cfg.setProperty("hibernate.connection.username", username); cfg.setProperty("hibernate.connection.username", username);
cfg.setProperty("hibernate.connection.password", password); cfg.setProperty("hibernate.connection.password", password);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment