private synchronized int getNextIdAndIncrement() {
		int nextId = 0;
		try (Connection connection = DriverManager.getConnection(connectionString);){
			Statement statement = connection.createStatement();
			ResultSet rs = statement.executeQuery("select max(id) as maxRec from recipe");
			if (rs.next()) {
				nextId = rs.getInt("maxRec") + 1;
			} else {
				throw (new SQLException("Couldn't get next id"));
			}
			connection.close();
		} catch (SQLException ex) {
			ex.printStackTrace();
			System.exit(-1);
		}
		return nextId;
	}