aspose file tools*
The moose likes JDBC and the fly likes SQl Server error converting datetime to smalldatetime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQl Server error converting datetime to smalldatetime" Watch "SQl Server error converting datetime to smalldatetime" New topic
Author

SQl Server error converting datetime to smalldatetime

Vijay Bala
Greenhorn

Joined: Oct 25, 2001
Posts: 25
Hi,
I am using a SQL Server stored proc.I am trying to update a smalldatetime column and get the error "error converting datetime to smalldatetime". Another smalldatetime column in the table has the format "yyyy-mm-dd hh:mm:ss".
I tried the foll code:
long i = drvo.getDateOfBirth().getTime();//getDateOfBirth returns a java.util.Date
call.setDate(1,new java.sql.Date(i));
//call.setTimestamp(1,new java.sql.Timestamp(i));
Using both the setDate and setTimestamp gave me the same error.I am using the sql server type 4 driver for 7.0.I tried using Resultsetmetadata and got the column type to be Timestamp from the table.Its defined as smalldatetime in the table.
Thanx in advance for any help,
Vijay
sahana sah
Greenhorn

Joined: Dec 04, 2007
Posts: 1
I have got the same problem. Any one to help??
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

"sahana2007",
Please check your private messages for a message from me.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
wood burning stoves
 
subject: SQl Server error converting datetime to smalldatetime