protected int insertWithReturn(String sql) {
		try {
//			createConnection();
			createPreparedStatement(sql);
			int affectedRows = pstmt.executeUpdate();
			
			if (affectedRows == 0) {
	            throw new SQLException("Creating failed, no rows affected.");
	        }
			
			try (ResultSet generatedKeys = pstmt.getGeneratedKeys()) {
	            if (generatedKeys.next()) {
	                return generatedKeys.getInt(1);
	            } else {
	                throw new SQLException("Creating user failed, no ID obtained.");
	            }
	        }
			
		} catch (SQLException e) {
			errorLog(sql, e);
		} finally {
			try {
				closePreparedStatement();
//				closeConnection();
			} catch (SQLException e) {
				errorLog(sql, e);
			}
		}
		
		return 0;
	}