public void actionPerformed(ActionEvent arg0) {
try{
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/sistemarfid?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&useTimezone=true&serverTimezone=UTC", "root", "12345");
String sql = "select cod_barras from produto where cod_barras = ?";
PreparedStatement pstm = null;
ResultSet rs = null;
rs = pstm.executeQuery("select cod_produto, descricao from produto");
pstm = con.prepareStatement(sql);
while (rs.next()){
codigo_produto_rfid.setText(String.valueOf(rs.getInt(1)));
}
pstm.execute();
pstm.close();
con.close();
}catch (SQLException e){
System.out.println (e);
}
catch (Exception e) {System.out.println (e);}
}
});``