public static Connection getConnection() {
        if (connection != null) {
            return connection;
        }

        try {
            Properties props = new Properties();
            InputStream inputStream = DBInitializer.class.getResourceAsStream("/connect.properties");

            if (inputStream == null) {
                throw new IllegalArgumentException("Can not load properties file");
            }

            props.load(inputStream);

            String drivers = props.getProperty("jdbc.driver");
            if (drivers != null) {
                Class.forName(drivers).newInstance();
            }
            String address = props.getProperty("jdbc.address");
            String dbName = props.getProperty("jdbc.db.name");
            String url = address + dbName; //append ip + db name
            String user = props.getProperty("jdbc.username");
            String password = props.getProperty("jdbc.password");
            connection = DriverManager.getConnection(url, user, password);
        } catch (IOException e1) {
            System.err.println("Could not read properties. No DB connection will be established" + e1);
        } catch (SQLException e) {
            System.err.println("Could not connect to DB." + e);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return connection;
    }