hi, I have a sql table which has 7 column and the first six column ,store string type but the last one store BLOB type.I get those 6 String types with the addBirth method and for storing the image for last column ,I use insertImageToBirthTable method. I want to store Strings and BLOB not together because the user may not chose a photo for adding a person.(I have edited my post and now I use this method for storing my image but it still have null value in the SQL table,why???)Also I have printed pathfile and it wasn't null.
my insertImageToBirthTable method:
public static void insertImageToBirthTable(String name, String family, String fatherName, String motherName, String dateOfBirth, String placeOfBirth, String pathFile) {
try {
System.out.println(pathFile);
File file = new File(pathFile);
FileInputStream input = new FileInputStream(file);
PreparedStatement stmt = (PreparedStatement) conn.prepareStatement("UPDATE birthtable SET image =? WHERE name = '" + name + "'AND family ='" + family + "'AND fatherName = '" + fatherName + "'AND motherName ='" + motherName + "' AND dateOfBirth = '" + dateOfBirth + "' AND placeOfBirth = '" + placeOfBirth + "'");
stmt.setBinaryStream(1, input);
stmt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
}