I need to upload an image that is stored in MySQL This table called conductors contains these columns:
I managed to save them but now I need to obtain them when the user searches for that driver by his personal identity number.
I have obtained the other information but I do not know how to get the photo here I show you the code.
public void ConsultarConductor(String cedulaC, Connection claseJava) {
try {
PreparedStatement stmt = claseJava.prepareStatement("SELECT nombre, cedula, fechanac, lugarnac, nacionalidad, tiposangre, padecimiento, numerolicencia, tipolicen, licenciaexpedida, licenciaexpira, numempleado, ruta, imagen FROM conductores WHERE cedula = ? ");
stmt.setString(1, cedulaC);
ResultSet result = stmt.executeQuery();
while (result.next()) {
NombreC.setText(result.getString(1));
CedC.setText(result.getString(2));
FechaNac.setValue(result.getDate(3).toLocalDate());
LugarNac.setText(result.getString(4));
Nacionalidad.setText(result.getString(5));
TipoSangre.setValue(result.getString(6));
Padecimiento.setText(result.getString(7));
NumLic.setText(result.getString(8));
TipoLic.setValue(result.getString(9));
LicExpedida.setValue(result.getDate(10).toLocalDate());
LicExpira.setValue(result.getDate(11).toLocalDate());
NumEmpleado.setText(result.getString(12));
txt_rutafoto.setText(result.getString(13));
img_verfoto.setText(result.getString(14));
}
Actualizar.setDisable(false);
} catch (SQLException ex) {
ex.printStackTrace();
}
}