public boolean write( )
	{
		boolean result = false;
		
		try { //Try to load the mysql Driver
			Class.forName("com.mysql.jdbc.Driver");

			try { //Try to open a connection to the mysql server
				String url = settingsMap.get("URL");
				String user = settingsMap.get("username");
				String passwd = settingsMap.get("password");
				Connection con = null;
				con = DriverManager.getConnection(url, user, passwd);
								
				Statement statement = con.createStatement();

				//prepare a string representing inputDevice data
				String valueString = "";
				String columnsString = "";
				boolean first = true;
				
				
				
				for ( String key : targetDevice.getCurrentDataMap().keySet())
				{
					if (first == false)
					{
						valueString = valueString+",";
						columnsString = columnsString+",";
					}
					columnsString = columnsString + key;
					String value = targetDevice.getCurrentDataMap().get(key)[0];
					try{ //check if value is truly a number, else surround with quote marks for string
						Double.parseDouble(value);
						valueString = valueString+value;
                    } catch(NumberFormatException e) {
                    	valueString=valueString+"'"+value+"'";
                    }
					first = false;
				}
				
				//finish preparing the entire sql query
				String table = settingsMap.get("table");
				String sql = "INSERT INTO "+table+" ("+columnsString+") VALUES ("+valueString+")";
				
				//DEBUG DEBUG DEBUG
				//System.out.println(sql);
				
				//execute query
				statement.execute(sql);
				result = true;
				
				try { //close all connections and statements

				      if (statement != null) {
				        statement.close();
				      }

				      if (con != null) {
				        con.close();
				      }
				    } catch (Exception e) {
				    	System.out.println("WARNING: Failed to close MySQL connection!");
				    }
				
			} catch (SQLException e) { //catch connection exception
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		} catch (ClassNotFoundException e) { //catch driver exception
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		return result;
	}