Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Beginning from MySQL 5.6.4, milliseconds support is provided for date columns like DATETIME etc.

I just created a table to check if its working:

create table testdata(startime  DATETIME(5));

However, when I save some DATE(java.lang.Date) value using iBATIS framework it is ignoring milliseconds and storing:

2012-04-16 17:54:55.00000

Any idea how to resolve this issue?

When I use an SQL query like INSERT INTO testdata VALUES ('2012-04-16 17:54:55.32345') it stores milliseconds properly. I want it to work via iBATIS.

share|improve this question
1  
Your problem is iBATIS, not MySQL. Perhaps better asked on StackOverflow? –  gbn Apr 16 '12 at 13:45
    
MySQL 5.6 is not officially released yet. So it may be a problem from that side or from iBATIS side or from the way you are connecting these two. –  ypercube May 17 '12 at 6:46
    
You could also test with MariaDB 5.5 which is a GA release and has milliseconds support (since 5.2 version I think). –  ypercube May 17 '12 at 6:47
add comment

1 Answer

Similar issue (both Hibernate and MyBatis don't store milliseconds) was solved by upgrading the MySQL driver from mysql-connector-java-5.1.17.jar to mysql-connector-java-5.1.26.jar.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.