Setting parameter for datetime in SQL Stored Procedure

I have a stored procedure with datetime parameter. But when I use CallableStatement to set parameter, I can only find setTimestamp. In fact, I can execute the Stored Procedure successfully, but I find the value in the result table is stored without 'seconds'.

For example:

passed value: "2001-8-15 09:12:45.000"

stored value: "2001-8-15 09:12:00" (datetime)

What happened? Hope someone may help!

[435 byte] By [kscindy] at [2007-9-26 4:03:34]
# 1
What database are you using?What jdbc driver are you using?Presumably you printed timestamp value just before you call the setTimestamp. How did you verify the stored value?
jschell at 2007-6-29 13:01:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

I am using SQL 2000 and connecting to it using ODBC.

As you said, before setting parameter, I have printed it on screen to verify the value. I tried not to use Stored Procedure, instead, I insert record directly by using Statement.ExecuteUpdate() method in servlet. I find the value is correct by this method (but I am passing the SAME value as I was using Stored Procedure!!)

kscindy at 2007-6-29 13:01:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Simply use setObject :cs.setObject(1,"2001-02-03 15:33:12");setObject is quite handy in the sense that U don't have to use specific set method for different object type !
wyeric at 2007-6-29 13:01:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4
That's right! The value in table is now correct! Thanks so much!
kscindy at 2007-6-29 13:01:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...