
Morning sir,
I want to view my picture(longblob) from My DB Mysql, I have a code like this.
try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:hyt","root","hayatinew"); Statement stat = con.createStatement(); ResultSet res = stat.executeQuery("select * from karyawan_ft where nik ='"+jTextField35.getText()+"'"); if (res.next()) { //jTextField35.setText(res.getString("nik")); eGambar.setText(foto(jTextField35.getText())); Blob blob1 = res.getBlob("foto"); jLabel38.setIcon(new javax.swing.ImageIcon(blob1.getBytes(1, (int) (blob1.length())))); }else{ JOptionPane.showMessageDialog(null,"aaa"); } } catch (Exception e) { JOptionPane.showMessageDialog(null,""+e); }
But i have error, Java.Lang.UnsupportedOPertaionException. Please help me, Thank you

Here is a code that displays the name, address and image of a person on the jframe.
Follow these steps:
1)Go to the start->Control Panel->Administrative Tools-> data sources.
2)Click Add button and select the driver Microsoft Access Driver(*.mdb).
3)After selecting the driver, click finish button.
4)Then give Data Source Name and click ok button.
5)Your DSN will get created.
6)Create a table 'user' in MS access database and add following fields to it.
id of Autonumber type name of Text type address of Text type image of OLE Object type.
6) Restart your compiler and compile your java code.
import java.sql.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class RetrieveImage{
public static void main(String[] args)throws Exception{
JFrame f=new JFrame();
f.setLayout(null);
JLabel lab1=new JLabel();
JLabel lab2=new JLabel("Name");
JTextField text1=new JTextField(20);
JLabel lab3=new JLabel("Address");
JTextField text2=new JTextField(20);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:student");
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("select * from user where id=1");
byte[] bytes = null;
if(rs.next()){
String name=rs.getString("name");
text1.setText(name);
String address=rs.getString("address");
text2.setText(address);
bytes = rs.getBytes("image");
Image image = f.getToolkit().createImage(bytes);
ImageIcon icon=new ImageIcon(image);
lab1.setIcon(icon);
}
lab1.setBounds(150,10,100,100);
lab2.setBounds(10,120,100,20);
text1.setBounds(150,120,100,20);
lab3.setBounds(10,150,100,20);
text2.setBounds(150,150,100,20);
f.add(lab1);
f.add(lab2);
f.add(text1);
f.add(lab3);
f.add(text2);
f.setVisible(true);
f.setSize(350,200);
}
}