public boolean checkCreateTables() {
		boolean retVal = true;
		DatabaseMetaData metaData;

		String[] tableNames = { "users", "photos", "comments" };
		String creationQuery = "";
		boolean exists = false;

		for (String tableName : tableNames) {
			if (openConnection()) {
				try {
					metaData = connection.getMetaData();
					resultSet = metaData.getTables(null, null, tableName, null);
					exists = resultSet.next();
				} catch (SQLException e) {
					logger.log(Level.SEVERE,
							"Error while checking table existence.", e);
				}

				if (!exists) {
					switch (tableName) {
					case "users":
						creationQuery = "CREATE TABLE users( "
								+ "user_id INT(5) AUTO_INCREMENT, "
								+ "firstName VARCHAR(100) NOT NULL, "
								+ "lastName VARCHAR (100) NOT NULL, "
								+ "userName VARCHAR (100) NOT NULL, "
								+ "password VARCHAR (50) NOT NULL, "
								+ "email VARCHAR (150) NOT NULL, "
								+ "active TINYINT (1) NOT NULL, "
								+ "type TINYINT (1) DEFAULT 0, "
								+ "PRIMARY KEY (user_id), "
								+ "CONSTRAINT uniqueEmail UNIQUE (email), "
								+ "CONSTRAINT uniqueUserName UNIQUE (userName) "
								+ ") ENGINE=InnoDB";
						break;
					case "photos":
						creationQuery = "CREATE TABLE photos( "
								+ "photo_id INT(5) AUTO_INCREMENT, "
								+ "path VARCHAR(200) NOT NULL, "
								+ "caption VARCHAR (150) DEFAULT NULL, "
								+ "date DATETIME DEFAULT NULL, "
								+ "category VARCHAR(75) NOT NULL, "
								+ "removalStatus TINYINT (1) DEFAULT 0, "
								+ "rating INT(1) DEFAULT NULL, "
								+ "PRIMARY KEY (photo_id) " + ") ENGINE=InnoDB";
						break;
					case "comments":
						creationQuery = "CREATE TABLE comments( "
								+ "comment_id INT(5) AUTO_INCREMENT, "
								+ "user_id INT(5) NOT NULL, "
								+ "photo_id INT(5) NOT NULL, "
								+ "rating INT(1) DEFAULT NULL, "
								+ "text VARCHAR(150) NOT NULL, "
								+ "date DATETIME DEFAULT NULL, "
								+ "active TINYINT (1) DEFAULT 1"
								+ "PRIMARY KEY (comment_id), "
								+ "CONSTRAINT commentPhotoForeign (photo_id) REFERENCES photos (photo_id), "
								+ "CONSTRAINT commentUserForeign (user_id) REFERENCES users (user_id) "
								+ ") ENGINE=InnoDB";
						break;
					}

					try {
						preparedStatement = connection
								.prepareStatement(creationQuery);
						preparedStatement.executeUpdate();
					} catch (SQLException e) {
						retVal = false;
						logger.log(Level.SEVERE, "Error creating table", e);
					} finally {
						try {
							preparedStatement.close();
						} catch (SQLException e) {
							logger.log(Level.SEVERE, "Error closing statement",
									e);
						}
					}
				}
				closeConnection();
			}
		}

		return retVal;
	}