I'm making a code in java that executes an Oracle database procedure The format I have to put there in the procedure when I run through the database is dd/MM/yyyy. I have to send this date from my java code using a CallebleStatement setDate with the date yyyy-MM-dd (which is the Date format in java) When this CallebleStatement is executed, will it transform the date I'm sending to the database format, or will it write to the Java format?
EDIT: It is basically this:
if(types[1].compareTo("DATE") == 0) {//procedureValues[i] = yyyy-MM-dd HH:mm:ss
cs.setDate(i+1, Date.valueOf(procedureValues[i].trim()));
}else {
cs.setObject(i+1, procedureValues[i].trim(), SQLTypes.valueOf(types[1]).getTypes());
}
And yes, the procedure expects the DATE format
SimpleDateFormat? If you provide a sample of your code, we might provide an answerSimpleDateFormatclass. We have so much better injava.time, the modern Java date and time API, and itsDateTimeFormatter.setDate(), Since JDBC 4.2 the recommended way is to usesetObject()and pass aLocalDateto it. And not worry about its format.