Erro para adicionar imagens (Netbeans MySql)

Pessoal, preciso de mais uma ajuda.
Não estou conseguindo adicionar uma imagem ao banco de dados.

A intenção seria ao realizar um cadastro adicionar junto aos dados uma imagem, depois visualisar ela ao selecionar o aluno cadastrado…

Seguem:


Botão cadastrar: “aparentemente sem erros”


private void jBt_CadastrarActionPerformed(java.awt.event.ActionEvent evt) {                                              
        
    AlunoControl control = new AlunoControl();
    Aluno a = new Aluno();

    int idade = 0;
    if(!jTf_Idade.getText().equals("")){
        idade = Integer.parseInt(jTf_Idade.getText());
    }
    
    a.setNome(jTf_Nome.getText());
    a.setIdade(idade);
    a.setTelefone(jTf_Telefone.getText());
    a.setEmail(jTf_Email.getText());
    a.setEndereco(jTf_Endereco.getText());
    a.setUf((String) jCb_Uf.getSelectedItem());
    a.setCidade((String) jCb_Cidade.getSelectedItem());
    a.setPai(jTf_Pai.getText());
    a.setMae(jTf_Mae.getText());
    a.setImage(jTf_Imagem.getText());
    
    
    if(control.cadastro(a)){
       limparCampos(); 
    }
    
    
}

Botão add imagem: “aparentemente sem erros”


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         

    JFileChooser chooser = new JFileChooser();
    chooser.showOpenDialog(null);
    File f = chooser.getSelectedFile();
    filename=f.getAbsolutePath();
    
    path.setText(filename);
    
    
    try{
        File image = new File(filename);
        FileInputStream fis = new FileInputStream(image);
        ByteArrayOutputStream bos=new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        for(int readNum; (readNum=fis.read(buf))!=-1;){
            
            bos.write(buf,0,readNum);
    
        }
        person_image=bos.toByteArray();
        
    } catch(Exception e){
        JOptionPane.showMessageDialog(null, e);
    }
    
}                                        

Classe AlunoDAO: “com erros nas imagens”


package DAO;

import Model.Aluno;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class AlunoDAO {

public boolean insert(Aluno a){
    String sql = "INSERT INTO alunos VALUES (0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    
    try {
        
        Connection con = ConexaoDAO.abrirConexao();
        PreparedStatement ps = null;
        ps = con.prepareStatement(sql);
        
        ps.setString(1, a.getNome());
        ps.setInt(2, a.getIdade());
        ps.setString(3, a.getTelefone());
        ps.setString(4, a.getEmail());
        ps.setString(5, a.getEndereco());
        ps.setString(6, a.getUf());
        ps.setString(7, a.getCidade());
        ps.setString(8, a.getPai());
        ps.setString(9, a.getMae());
        ps.setBytes(10, person_image());
        
        if(ps.executeUpdate() > 0 ){
            return true;
            
        }
        else {
            return false;
        }
        
    } catch (SQLException e){
        e.printStackTrace();
        
    }
    return false;
}

public List<Aluno> listarAlunos(String sql){
    List<Aluno> lista = new ArrayList<>();
    
    try {
Connection con = ConexaoDAO.abrirConexao();
PreparedStatement ps = null;
ps = con.prepareStatement(sql);

ResultSet rs = ps.executeQuery();

if(rs != null) {
    while(rs.next()){
        Aluno a = new Aluno();
        
        a.setId(rs.getInt(1));
        a.setNome(rs.getString(2));
        a.setIdade(rs.getInt(3));
        a.setTelefone(rs.getString(4));
        a.setEmail(rs.getString(5));
        a.setEndereco(rs.getString(6));
        a.setCidade(rs.getString(7));
        a.setUf(rs.getString(8));
        a.setPai(rs.getString(9));
        a.setMae(rs.getString(10));
        a.setImage(rs.getBytes(11));
        
        lista.add(a);
        
    }
    return lista;
}

} catch (SQLException e) {
e.printStackTrace();
}
return null;
}

    public boolean update(Aluno a){
    String sql = "UPDATE Alunos SET Nome = ?, Idade = ?, Telefone = ?, Email = ?, Endereco = ?, Uf = ?, Cidade = ?, Pai = ?, Mae = ?, image = ? WHERE Id = ?";
    
    try {
        
        Connection con = ConexaoDAO.abrirConexao();
        PreparedStatement ps = null;
        ps = con.prepareStatement(sql);
        
        ps.setString(1, a.getNome());
        ps.setInt(2, a.getIdade());
        ps.setString(3, a.getTelefone());
        ps.setString(4, a.getEmail());
        ps.setString(5, a.getEndereco());
        ps.setString(6, a.getUf());
        ps.setString(7, a.getCidade());
        ps.setString(8, a.getPai());
        ps.setString(9, a.getMae());
        ps.setBytes(10, a.getImage());
        ps.setInt(11, a.getId());
        
        if(ps.executeUpdate() > 0 ){
            return true;
            
        }
        else {
            return false;
        }
        
    } catch (SQLException e){
        e.printStackTrace();
        
    }
    return false;
}

    public Aluno listaraluno(int id){
        String sql = "Select * FROM alunos WHERE Id = " + id;
        
        Aluno a = null;
        
        try {
            Connection con = ConexaoDAO.abrirConexao();
            PreparedStatement ps = null;
            ps = con.prepareStatement(sql);
            
            ResultSet rs = ps.executeQuery();
            
            if(rs != null){
                while(rs.next()){
                    a = new Aluno();
                   
                    a.setId(rs.getInt(1));
                    a.setNome(rs.getString(2));
                    a.setIdade(rs.getInt(3));
                    a.setTelefone(rs.getString(4));
                    a.setEmail(rs.getString(5));
                    a.setEndereco(rs.getString(6));
                    a.setUf(rs.getString(7));
                    a.setCidade(rs.getString(8));
                    a.setPai(rs.getString(9));
                    a.setMae(rs.getString(10));
                    a.setImage(rs.getBytes(11));
                    
                    
                }
                return a;
                
            }
            
        } catch (SQLException e){
            e.printStackTrace();
        }
        return null;
    }
    
public boolean delete(int id){
    String sql = "DELETE FROM alunos WHERE Id = " + id;
    
    try{
        
        Connection con = ConexaoDAO.abrirConexao();
        PreparedStatement ps = null;
        ps = con.prepareStatement(sql);
        
        if (ps.executeUpdate() > 0){
            return true;
        }
        else{
            return false;
        }
    } catch (SQLException e){
        e.printStackTrace();
    }
    return false;
}    
 
    byte[] person_image=null;

}


Se puderem me ajudar seria muito grato…

Esse é o meu botão de selecionar foto, e quando ela é selecionada, a imagem vai pra o “campofoto” que é um jLabel.

JFileChooser chooser = new JFileChooser();
        chooser.setAcceptAllFileFilterUsed(false);
        FileNameExtensionFilter filter = new FileNameExtensionFilter("Somente Imagens (.jpg e .png)", "jpg", "png");
        chooser.addChoosableFileFilter(filter);
        chooser.setDialogTitle("Selecione uma foto para o visitante");
        chooser.showOpenDialog((null));
        File f = chooser.getSelectedFile();

    filename = f.getAbsolutePath();
            ImageIcon imageIcon = new ImageIcon(new ImageIcon(filename).getImage().getScaledInstance(campofoto.getWidth(), campofoto.getHeight(), Image.SCALE_DEFAULT));
            campofoto.setIcon(imageIcon);
            
            try {
                File image = new File(filename);
                FileInputStream fis = new FileInputStream(image);
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                byte[] buf = new byte[1024];
            
                for (int number; (number = fis.read(buf)) != -1;) {
                    bos.write(buf, 0, number);
                }
                person_image = bos.toByteArray();
            } catch (IOException e) {
                JOptionPane.showMessageDialog(null, e);
            }

Pra salvar:

pst.setBytes(13, person_image);

Minhas strings globais:

private final ImageIcon format = null;
String filename;
byte[] person_image = null;

Pra puxar a foto do cadastro já salvo:

byte[] image = conecta.rs.getBytes("imagem");
ImageIcon imageIcon = new ImageIcon(new ImageIcon(image).getImage().getScaledInstance(campofoto.getWidth(), campofoto.getHeight(), Image.SCALE_SMOOTH));
campofoto.setIcon(imageIcon);