• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC and smalldatetime - ms sql server 2008

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am trying to insert a record. one field is described as smalldatetime on a table in ms sql server 2008. I am using the prepared statement to insert the record. for example, if i am getting the data from a textfield on a panel, my code is like this:


I am getting "conversion from datetime data type to smalldatetime data type resulted in a smalldatetime overflow error". I am using jtds driver.

Can you help?

 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Smalldatetime can't store as much data as datetime, hence the error. smalldatetime is SQL Server specific data type so if you want to use it you'll need to use the driver-specific classes to support it. jTDS has a DateTime class to do conversions.
 
Thomas D Kim
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul,

Thanks for a quick reply.

I am having a problem with the jtds DateTime class. Apparently their constructors are all private and i don't know how to access it.

Can you give me an example?


Thanks,

Thomas Kim
 
LOOK! OVER THERE! (yoink) your tiny ad is now my tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic