I have a database where I have a field that is type DATE and I want to make a function in java to insert values in the database. The problem is that when I insert a Date I get a NULL in the database DATE field.
I'm doing this:
PreparedStatement stmt = null:
stmt = conn.prepareStatement("INSERT INTO DB1(print_date) values(?)";
stmt.setDate(1, database.getPrintDate());
stmt.executeUpdate();
How can I insert the PrintDate which is DATE type in the database? Thank you