Issue with retrieving dates in SQL Server

I am trying to list the dates registered in a table with SQL Server, but my problem is that all the dates I retrieve are different than 2 days with dates in the table.

For example, I got 2012-12-25 in my database, and when I retrieve it and drop it in Java.util.Date, it becomes 2012-12-23 ...

I have processes in dates in another table that are working fine.

I am using SQL Server 2008, Hibernate 3, and Spring 3.

Edit:

The column data type for the table is the date, I get it using hibernate, so here my hibernation request is called:

public List<Holiday> retrieveAllHolidays() { return (List<Holiday>) sessionFactory.getCurrentSession().createQuery("from Holiday") .list(); } 

The holiday object received two attributes: String and Date (this is incorrect after retrieving from the database).

+6
source share
1 answer

The problem was related to JRE 7 driver support for JDBC (problem with getDate () function).

See this post for more information: Microsoft JDBC Development Team Blog

Thanks again, Martin Kuz, for pointing out this other problem!

+4
source

Source: https://habr.com/ru/post/907310/


All Articles