public void saveInventory(String name, HashMap hashInv) throws DatabaseException, SQLException {	
		Vector<Integer> slots = new Vector<Integer>();
		Vector<Integer> remove = new Vector<Integer>();
		int ID = getPlayerId(name);
		int slot;
		
		Transaction trans = new JDBCTransaction(createConnection());
		Connection connection = ((JDBCTransaction)trans).getConnection();
			Statement stmt=connection.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,
                    								   ResultSet.CONCUR_UPDATABLE);
				  String query = "SELECT * FROM inventory WHERE id like '"+ID+"'";
		ResultSet result = stmt.executeQuery(query);
		if(!result.next()) {
			newInventory(trans,ID,hashInv);
		}else{
			result.beforeFirst();
			do {
					if(result.next()) {
				    	slot = result.getInt("slots");
				    	if (hashInv.containsKey(slot)){
				    		slots.add(slot);
				    	}else{
				    		remove.add(slot);
				    	}	
					}
			} while(!result.isLast());
			
			for(int r = 0;r<remove.size();r++){
				slot = remove.get(r);
				try{
						query =	"DELETE FROM inventory WHERE id="+ID+" AND slots="+slot+";";
						stmt.execute(query);
				} catch(Exception e) {
//					Slog.error(e,e.getLocalizedMessage());
				}
			}
				  
			for(int s = 0;s<slots.size();s++){
				slot = slots.get(s);
				if (hashInv.containsKey(slot)){
					query =	"UPDATE inventory SET slots="+slot+",item="+hashInv.remove(slot)+ " WHERE id="
							+ID+" AND slots="+slot+";";
					stmt.execute(query);
				}
			}
			if(!hashInv.isEmpty())
				newInventory(trans,ID,hashInv);
		}
	}