public void changeAvail(String username, int bookId) {
   Connection connection = null;
   Book book = getBook(username, bookId);
   try {
     connection = getConnection();
     if (book.getAvailability().equals("in")) {
       PreparedStatement statement =
           connection.prepareStatement(
               "UPDATE " + username + " set availability = 'out' where id = " + bookId);
       statement.executeUpdate();
     } else {
       PreparedStatement statement =
           connection.prepareStatement(
               "UPDATE " + username + " set availability = 'in' where id = " + bookId);
       statement.executeUpdate();
     }
   } catch (SQLException ex) {
     ex.printStackTrace();
   } finally {
     closeConnection(connection);
   }
 }
 public void addBook(String username, Book book) {
   Connection connection = null;
   try {
     connection = getConnection();
     PreparedStatement statement =
         connection.prepareStatement(
             "insert into "
                 + username
                 + " (title, author, category, year, color, level, availability)"
                 + " values (?, ?, ?, ?, ?, ?, ?)");
     statement.setString(1, book.getTitle());
     statement.setString(2, book.getAuthor());
     statement.setString(3, book.getCategory());
     statement.setInt(4, book.getYear());
     statement.setString(5, book.getColor());
     statement.setInt(6, book.getLevel());
     statement.setString(7, book.getAvailability());
     statement.executeUpdate();
   } catch (SQLException ex) {
     ex.printStackTrace();
   } finally {
     closeConnection(connection);
   }
 }