I have some images saved in a database in postgresql type "Blob" I want to know how to view it within a table with other information. I have saved the "setBinaryStream" method.
Eg "pic" returns:
(\xffd8ffe000104a46494600010100000100010000ffe13297457869660000)
I want to show the picture in the cell.
My code:
public void loading() {
try {
String[]title = {"First Name","Last Name","Photo"};
String sql="select * from users";
model = new DefaultTableModel(null,title);
st = conn.createStatement();
ResultSet rs = st.executeQuery(sql);
String[]fila = new String[4];
while(rs.next()){
fila[0] = rs.getString("fna");
fila[1] = rs.getString("lna");
fila[2] = rs.getString("pic");
model.addRow(fila);
}
tbl.setModel(model);
}
catch (SQLException e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
Any ideas how to view the image in the table?