public void createAccount(String username, String password, UserRole role) throws DuplicateAccountException, IOException {
		
		/**
		 * Don't use the SQLStatementProcessor here since we're actually expecting SQLExceptions when there 
		 * are duplicate nicks
		 */
		PreparedStatement stmt = null;
		Connection con = null;
		try {
			con = connectionPool.getConnection();
			
			stmt = con.prepareStatement("INSERT INTO valid_accounts (username, password_hash, max_registrations) VALUES (?, ?, ?)");
			
			String passHash = "MD5:" + TypeUtil.toHexString(getPasswordHash(password));
			
			stmt.setString(1, username);
			stmt.setString(2, passHash);
			try {	
				stmt.setInt(3, Integer.parseInt(System.getProperty(EmbeddedServer.Setting.KEY_REG_LIMIT_ACCOUNT.getKey())));
			} catch( NumberFormatException e ) { 
				e.printStackTrace();
			}
			
			stmt.executeUpdate();
			stmt.close();
			
			stmt = con.prepareStatement("SELECT uid FROM valid_accounts WHERE username = ?");
			stmt.setString(1, username);
			ResultSet rs = stmt.executeQuery();
			rs.next();
			long newID = rs.getLong(1);
			stmt.close();
			
			stmt = con.prepareStatement("INSERT INTO user_roles (uid, role_id) VALUES (?, ?)");
			stmt.setLong(1, newID);
			stmt.setLong(2, role.getID());
			stmt.executeUpdate();
			stmt.close();
			
		} catch( SQLException e ) {
			if( e.toString().toLowerCase().contains("duplicate key value") || e.toString().toLowerCase().contains("duplicate entry") ) {
				throw new DuplicateAccountException();
			}
			e.printStackTrace();
			logger.warning(e.toString());
			
			throw new IOException(e.toString());
		}
		finally {
			try {
				con.close();
			} catch( SQLException e ) {
				e.printStackTrace();
				logger.warning(e.toString());
			}
		}
	}