File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQl Server error converting datetime to smalldatetime" Watch "SQl Server error converting datetime to smalldatetime" New topic

SQl Server error converting datetime to smalldatetime

Vijay Bala

Joined: Oct 25, 2001
Posts: 25
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,
sahana sah

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

Joined: May 26, 2003
Posts: 30136

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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: SQl Server error converting datetime to smalldatetime
Similar Threads
error in servlet
JDBC and smalldatetime - ms sql server 2008
java sql TYPE
data type mapping between POJO class and database data type
java.util.Date to java.sql.Date