import java.sql.*;
import java.util.ArrayList;

public class DatabaseConnection {
public static Connection dbcon;
public static Statement stmt;
	public static void InsertData(ArrayList<String> array, String path) {
		try {
			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
			dbcon = DriverManager.getConnection("jdbc:sqlserver://serverName:1025;databaseName=complet;user=team3;password=2016;");
			stmt = dbcon.createStatement();
			String pathHtml;
			int position;
		    for(int i = 0; i < array.size(); i++) {
		        position = i;
				pathHtml = path + "/" + Integer.toString(i) + ".html";
				stmt.executeUpdate("INSERT INTO DatabaseOfURLs VALUES('" + position + "','" + array.get(i) + "','" + pathHtml + "')");
            }
    		stmt.close();
		    dbcon.close();

        } catch (SQLException sqle) {
					System.err.println(sqle);
		} catch (Exception e) {
			System.err.println(e);
		} finally {
			try {
				if (stmt != null) {
					stmt.close();
				}
			} catch (SQLException sqle2) {
				System.err.println(sqle2);
			}
			try {
				if (dbcon != null) {
					dbcon.close();
				}
			} catch (SQLException sqle) {
				System.err.println(sqle);
			}
		}
	}
}

@@ -1,21 +1,140 @@
-import java.sql.*
+package com.complet;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.DriverManager;%0Aimport java.sql.SQLException;%0Aimport java.sql.Statement
 ;%0Aim
@@ -194,16 +194,20 @@
 ction %7B%0A
+    
 public s
@@ -230,16 +230,20 @@
  dbcon;%0A
+    
 public s
@@ -264,17 +264,20 @@
 t stmt;%0A
-%09
+    
 public s
@@ -291,55 +291,31 @@
 oid 
-InsertData(ArrayList%3CString%3E array, String path
+openDatabaseConnection(
 ) %7B%0A
@@ -427,16 +427,22 @@
 nection(
+%0A%09%09%09%09%09
 %22jdbc:sq
@@ -455,77 +455,256 @@
 r://
-serverName:1025;databaseName=complet;user=team3;password=2016
+%22.concat(GetCredentials.getSqlServerPath()).concat(%22;databaseName=%22)%0A%09%09%09%09%09.concat(GetCredentials.getDbName()).concat(%22;user=%22).concat(GetCredentials.getDbUser())%0A%09%09%09%09%09.concat(%22;password=%22).concat(GetCredentials.getDbPassword()).concat(%22
 ;%22)
+)
 ;%0A%09%09
-%09
+    
 stmt
@@ -731,16 +731,218 @@
 ment();%0A
+%09%09 %7D catch (SQLException sqle) %7B%0A%09%09%09System.err.println(sqle);%0A%09%09 %7D catch (Exception e) %7B%0A%09%09%09System.err.println(e);%0A%09%09 %7D%0A%09%7D%0A%09public static void InsertData(ArrayList%3CString%3E array, String path) %7B%0A%09%09try %7B%0A
 %09%09%09Strin
@@ -970,16 +970,45 @@
 sition;%0A
+%09%09%09openDatabaseConnection();%0A
 %09%09    fo
@@ -1348,18 +1348,16 @@
 e) %7B%0A%09%09%09
-%09%09
 System.e
@@ -1704,9 +1704,8 @@
 %09%09%7D%0A%09%7D%0A%7D
-%0A

Create a separate method to connect with Database