@@ -307,9 +307,11 @@ |
|
@GET |
@Produces(MediaType.APPLICATION_XML) |
- public Response fetchFile(@Context UriInfo uriInfo, |
- @Context HttpServletRequest httpReq){ |
- |
+ public Response fetchFile(@Context UriInfo uriInfo,@Context HttpServletRequest httpReq) { |
+ String connStr = config().getString( |
+ "crlmod.latest.db", |
+ " " |
+ ); |
String requestString = httpReq.getQueryString(); |
MultivaluedMap<String, String> requestMap = uriInfo.getQueryParameters(); |
|
@@ -321,7 +323,7 @@ |
path = path.replaceAll("/", "\\"); |
|
String query = "SELECT xmlData FROM R2_Data WHERE path=? AND name=?"; |
- try (Connection conn = createDataSource(); PreparedStatement stmnt = conn.prepareStatement(query)) { |
+ try (Connection conn = createDataSource(connStr); PreparedStatement stmnt = conn.prepareStatement(query)) { |
stmnt.setString(1, path); |
stmnt.setString(2, name); |
|
@@ -349,12 +351,12 @@ |
.build(); |
} |
|
- private static synchronized Connection createDataSource() throws ClassNotFoundException, SQLException { |
+ private static synchronized Connection createDataSource(String connectString) throws ClassNotFoundException, SQLException { |
Connection connection = null; |
|
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); |
//System.out.println("Driver was loaded for: com.microsoft.sqlserver.jdbc.SQLServerDriver"); |
- connection = DriverManager.getConnection("jdbc:sqlserver://129.82.20.129:1433;databaseName=CR_LMOD_2022_step_r2;user=sa;password=csurams#1"); |
+ connection = DriverManager.getConnection(connectString); |
|
//System.out.println("Connection to the local Conservation Resources DB Service was successful\n================================================================================\n"); |
connection.setAutoCommit(true); |