The database I am working with has the date format as
DD-MON-RR
This is the table:
CREATE TABLE dependent (
Fname varchar2(15) not null,
bdate date,
);
I am currently trying to insert into a database using JDBC with the code
String insert = "INSERT INTO DEPENDENT(Fname,bdate) VALUES(?,?)";
PreparedStatement p = z.conn.prepareStatement(insert);
p.setString(1, "Billy");
String formatIn = "DD-MMM-YY";
SimpleDateFormat sdfi = new SimpleDateFormat(formatIn);
java.util.Date inDate = sdfi.parse("29-AUG-10");
java.sql.Date sqlDate = new java.sql.Date(inDate.getTime());
p.setDate(2, sqldate);
p.executeUpdate();
I thought this would fit the format expected, however it keeps giving me java.sql.SQLException: Io exception: Size Data Unit (SDU) mismatch
I'm unsure how to fix this