I have been trying all kinds of variety of options. Do you have a solution?
Again, all I want to do is update the date column with the current date and
time in this format - MM/DD/YY HH:MM:SS
I have the handle to the resultset and was able to set other fields/columns
but am unable to set the date. If you have another way/suggestion that
could be helpful, please pass it on. I am fairly new to Java but not to
coding.
Mark
> I have been trying all kinds of variety of options. Do you have a solution?
Yes, read the posts. John pointed you in the right direction.
> Again, all I want to do is update the date column with the current date and
> time in this format - MM/DD/YY HH:MM:SS
On the Java side of things it does not matter what the format in the
database is, as long as the JDBC driver understands the column to be a DATE.
> I have the handle to the resultset and was able to set other fields/columns
> but am unable to set the date.
I will repeat the comment from John:
>ResultSet.updateDate() requires a java.sql.Date.
See also:
java.util.Date.getTime()
and
java.sql.Date( long date )
But you could let the PreparedStatement do the work and look into:
public void setObject(int parameterIndex, Object x)
"The JDBC specification specifies a standard mapping from Java Object
types to SQL types. The given argument will be converted to the
corresponding SQL type before being sent to the database."
It always works for me, but be careful about Timezones while
you do this.
-Paul