@Override
    synchronized public void addBook(final Book book) {
        Connection conn = null;
        PreparedStatement stmt = null;

        try {
            conn = dataSource.getConnection();
            stmt = conn.prepareStatement("INSERT INTO book(BOOK_NAME,BOOK_AUTHOR,BOOK_PUBLISHER,BOOK_PRICE,BOOK_DATE) VALUES(?,?,?,?,?)");//插入資料
            stmt.setString(1, book.getBook_Name());
            stmt.setString(2, book.getBook_Author());
            stmt.setString(3, book.getBook_Publisher());
            stmt.setInt(4, book.getBook_Price());
             stmt.setTimestamp(5, new Timestamp(new Date().getTime()));
            stmt.executeUpdate();
        } catch (SQLException ex1) {
            throw new RuntimeException(ex1);
        } finally {
            if (stmt != null) {
                try {
                    stmt.close();
                } catch (SQLException ex) {
                    Logger.getLogger(BookDAO.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException ex1) {
                    Logger.getLogger(BookDAO.class.getName()).log(Level.SEVERE, null, ex1);
                }
            }


        }

//        File bookFile=new File("/home/base/BookStore");
//        bookFile.mkdir();
//        BufferedWriter writer = null;
//        try {
//            writer = new BufferedWriter(new FileWriter(bookFile+"/"+book.getID()));
//            writer.write(book.getID()+"\t"+book.getName()+"\t"+book.getAuthor()+"\t"+book.getPublisher()+"\t"+book.getPrice());
//            writer.close();
//        } catch (IOException ex) {
//            Logger.getLogger(BookDAO.class.getName()).log(Level.SEVERE, null, ex);
//        }  

    }