public Database(String databasePath) throws SQLException {
		try {
			Class.forName("org.hsqldb.jdbcDriver");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

		connection = DriverManager.getConnection("jdbc:hsqldb:file:" + databasePath, "SA", "");
		
		Statement delayStmt = connection.createStatement();
		try {
			delayStmt.execute("SET WRITE_DELAY FALSE");
		} finally {
			delayStmt.close();
		}
		
		connection.setAutoCommit(false);
		
		Statement stmt1 = connection.createStatement();
		try {
			String messagesTable = "CREATE TABLE messages(nick VARCHAR(255) NOT NULL,"
					   + "message VARCHAR(4096) NOT NULL,"
					   + "timeposted BIGINT NOT NULL)";
			stmt1.execute(messagesTable);
		} finally {
			stmt1.close();
		}
		
		Statement stmt2 = connection.createStatement();
		try {
			String statisticsTable = "CREATE TABLE statistics(key VARCHAR(255), value INT)\n"
					   + "INSERT INTO statistics(key, value) VALUES ('Total messages', 0)\n"
					   + "INSERT INTO statistics(key, value) VALUES ('Total logins', 0)";
			stmt2.execute(statisticsTable);
		} finally {
			stmt2.close();
		}
		
		connection.commit();
	}