So zeigen Sie ein Bild von ms access to jpanel in Java NetBeans

Den Code, den ich benutzt habe:

private void okActionPerformed(java.awt.event.ActionEvent evt)        
{                                   
    try {
        String Update = name.getText();

        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection connection = DriverManager.getConnection("jdbc:odbc:NewPData");
        PreparedStatement psmnt = connection.prepareStatement("SELECT Image FROM Table1 where Name='" + Update + "'");
        ResultSet rs = psmnt.executeQuery();
        Blob blob = rs.getBlob("Image");
        int b;
        InputStream bis = rs.getBinaryStream("Image");

        FileOutputStream f = new FileOutputStream("Image.jpg");
        while ((b = bis.read()) >= 0) {
            f.write(b);
        }
        f.close();
        bis.close();

        icon = new ImageIcon(blob.getBytes(1L, (int) blob.length()));

        lblImage.setIcon(icon);

    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

Die Ausnahme zeigte:

       java.lang.UnsupportedOperationException

Ich habe das Bild zuerst in ms access gespeichert und möchte es nun auf einem Etikett anzeigen. Bitte helfen Sie.

Antworten auf die Frage(1)

Ihre Antwort auf die Frage