changeset 103:090035f79373

extract db url into config file
author Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
date Fri, 29 Sep 2017 16:15:28 +0200
parents 6a508b605b5f
children d5b8bfc9705c
files src/main/java/de/mpiwg/gazetteer/utils/DBService.java src/main/resources/config.properties
diffstat 2 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/gazetteer/utils/DBService.java	Fri Sep 29 16:03:06 2017 +0200
+++ b/src/main/java/de/mpiwg/gazetteer/utils/DBService.java	Fri Sep 29 16:15:28 2017 +0200
@@ -38,11 +38,6 @@
 	// JDBC driver name and database URL
 	static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
 
-
-	//static final String DB_URL = "jdbc:mysql://localhost/";
-	static final String DB_URL = "jdbc:mysql://194.94.134.66/";	// TODO: when move Gazetteer database to SBB, need to re-config this
-																// replace the IP with SBB's host IP: 194.94.134.66
-
 	private static String SECTIONS_TABLE = "sections_index";
 
 
@@ -1111,7 +1106,8 @@
 	public static Connection getNewConnection() throws SQLException, IOException{
 
 		return DriverManager.getConnection(
-				DB_URL + PropertiesUtils.getPropValue("db_gazetter_name") + "?useUnicode=yes&characterEncoding=UTF-8",
+				PropertiesUtils.getPropValue("db_gazetter_url") + 
+                PropertiesUtils.getPropValue("db_gazetter_name") + "?useUnicode=yes&characterEncoding=UTF-8",
 				PropertiesUtils.getPropValue("db_gazetter_username"),
 				PropertiesUtils.getPropValue("db_gazetter_password"));
 
--- a/src/main/resources/config.properties	Fri Sep 29 16:03:06 2017 +0200
+++ b/src/main/resources/config.properties	Fri Sep 29 16:15:28 2017 +0200
@@ -6,6 +6,7 @@
 #db_gazetter_name=Gazetteer
 
 # SBB server:
+db_gazetter_url=jdbc:mysql://194.94.134.66/
 db_gazetter_name=gazetteer
 db_gazetter_username=gazetteer
 db_gazetter_password=R-9C7Bmx%2