I am trying to retrieve the blob data type from the database table and displaying the image in the image view . Here my selection is the SQL statement:
recover the public boolean () {Boolean success = false; Results set rs = null; Dbctrroler db = new dbctrower (); Db.getConnection (); String dbQuery = "SELECT * smROMproduct WHERE productName = '" + + name + "'"; == db.readRequest (dbQuery); try {if (rs.next ()) {desc = rs.getString ("productDescription") ; Value = rs.getInt ("product value"); quantity = rs.getInt ("product quantity"); DateStr = rs.getString ("dateoffification"); category = rsgetstring ("productcategory"); blob blob = r .jetblob ("product image"); byte [] data = blob.getBytes (0, (int) blob.length ()); Image = ImageIO.read (new bytereinputstream (data)); // error here success = true ;}} Hold (Exception e) {e.printStackTrace ();} Db.terminate (); Return to Success;} Recovery After I am done, I want to display it in an image view. Here is the code:
panel.getMyImageView (). SetImage (product.getImage ()); < / Pre> However, I have received an incompatible type error message. I know that image = imageIO.read (new byteInputTerms); this line should be stored as a buffard image and then from there I - Change the image to datatype and display it in the image view. But after 2 hours of research, I could not find any luck. Can anyone help me with it?
Thanks in advance.
Toolkit.getDefaultToolkit (). CreateImage (data) Read it from Blob for the byte array
No comments:
Post a Comment