@Override
    public Book getBookByID(final Integer id) {
        Connection conn = null;
        PreparedStatement stmt = null;
        Book book = null;
        ResultSet rs = null;
        try {
            conn = dataSource.getConnection();
            stmt = conn.prepareStatement("SELECT BOOK_ID,BOOK_NAME,BOOK_AUTHOR,BOOK_PUBLISHER,BOOK_PRICE FROM BOOK WHERE BOOK_ID=?");
            stmt.setInt(1, id);
            rs = stmt.executeQuery();
            while (rs.next()) {//必須要有游標next才取的到值
                book = new Book(rs.getInt("BOOK_ID"), rs.getString("BOOK_NAME"), rs.getString("BOOK_AUTHOR"), rs.getString("BOOK_PUBLISHER"), rs.getInt("BOOK_PRICE"));
            }
        } catch (SQLException ex1) {
            throw new RuntimeException(ex1);
        } finally {
            if (rs != null) {
                try {
                    rs.close();
                } catch (SQLException ex) {
                    Logger.getLogger(BookDAO.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            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);
                }
            }

        }
        return book;
//        File folder = new File("/home/base/BookStore");//定義資料型態
//         folder.mkdir();
//         Book book =new Book();
//         BufferedReader reader=null;
//
//            reader=new BufferedReader(new FileReader(folder+"/"+id));
//            String[] line=null;
//            line=reader.readLine().split("\t");
//            book.setID(line[0]);
//            book.setName(line[1]);
//            book.setAuthor(line[2]);
//            book.setPublisher(line[3]);
//            book.setPrice(Integer.parseInt(line[4]));
//   

    }