The default in JdbcDataSource is to use ResultSet.getObject which
returns the underlying database's type. The type specific methods in
ResultSet are not invoked unless you are using convertType="true".

Is MySQL actually returning java.sql.Timestamp objects?

On Sat, Jun 29, 2013 at 5:22 AM, Bill Au <bill.w...@gmail.com> wrote:
> I am running Solr 4.3.0, using DIH to import data from MySQL.  I am running
> into a very strange problem where data from a datetime column being
> imported with the right date but the time is 00:00:00.  I tried using SQL
> DATE_FORMAT() and also DIH DateFormatTransformer but nothing works.  The
> raw debug response of DIH, it looks like the time porting of the datetime
> data is already 00:00:00 in Solr jdbc query result.
>
> So I looked at the source code of DIH JdbcDataSource class.  It is using
> java.sql.ResultSet and its getDate() method to handle date column.  The
> getDate() method returns java.sql.Date.  The java api doc for java.sql.Date
>
> http://docs.oracle.com/javase/6/docs/api/java/sql/Date.html
>
> states that:
>
> "To conform with the definition of SQL DATE, the millisecond values wrapped
> by a java.sql.Date instance must be 'normalized' by setting the hours,
> minutes, seconds, and milliseconds to zero in the particular time zone with
> which the instance is associated."
>
> This seems to be describing exactly my problem.  Has anyone else notice
> this problem?  Has anyone use DIH to index SQL datetime successfully?  If
> so can you send me the relevant portion of the DIH config?
>
> Bill



-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to