使用rs2xml显示带有图像的数据库表

时间:2014-08-15 00:50:27

标签: mysql sql jtable blob

我的代码我试图使用左连接显示数据库的内容,我已经完成了。我使用rs2xml在Jtable上显示左连接的数据库表。

但问题是db表的一个列上有图像。我将这些图像存储为BLOBS。在尝试显示我的左连接数据库表时,我得到了所有其他正确的东西,除了不是让图像有一些代码集在他们的位置。我的代码看起来像这样......

private void retrvStaffList() {
    try {
        //this sql uses LEFT JOIN to merge tables with corresponding foreign keys
        //hence we it is going to display all staff with their specified info retrieved from all the tables in ONE table...
        String sql = "SELECT DISTINCT s.StaffName, d.DeptName, b.age, b.telephone,b.email, b.address, t.position, t.salary FROM Staffs AS s\n"
                + "LEFT JOIN  Departments as d ON d.DepartmentID = s.DepartmentID\n"
                + "LEFT JOIN BioData AS b ON b.BioID = s.StaffID\n"
                + "LEFT JOIN StatusTable AS t ON t.ownerID = s.StaffID";
        PreparedStatement pStmt2 = connect.prepareStatement(sql);
        rs = pStmt2.executeQuery();
         do {
                //get the staff table...
                staffTable.setModel(DbUtils.resultSetToTableModel(rs));
                staffTable.setEnabled(false);

            } while (rs.next());
    } catch (SQLException ex) {
        Logger.getLogger(StaffList.class.getName()).log(Level.SEVERE, null, ex);
    }
}

我不知道我是否有办法完成任务。我做了一些搜索,但我看到的结果不得不与存储图像路径的人而不是图像本身(作为BLOB)。请我真的需要一个解决方法。提前谢谢......

0 个答案:

没有答案
相关问题