Jump to content

Date field of java.lang.Date type


dragokranjcec

Recommended Posts

I have a database accessed through ODBC driver and JDBC-ODBC Bridge. Date fields from my database map to ODBC type:

 SQL_TYPE_DATE=91, 10, 0, SQL_NULLABLE=1

(this is from MS ODBC Test utility)

These date fields are displayed normally in ODBC query tool, e.g. AQT:

Name     Type   Length Nulls
datKnj   DATE      10       Y

 

But, when I import fields using JDBC-ODBC bridge, date fields get type java.lang.Date, and of course compiler gives error:

java.lang.ClassNotFoundException: java.lang.Date

Is this a problem in JDBC driver or in JasperReports / iReport?

Link to comment
Share on other sites

  • 2 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

No, I did not define field as java.lang.Date. Problem was in ODBC driver.

SQL_TYPE_DATE is defined by ODBC standard as 10 character field with format YYYY-MM-DD. My ODBC driver was returning these values as 8 character field (without '-') and JDBC driver was confused and "invented" type java.lang.Date.

AQT was smart enough to interpret non-standard date format correctly, but JDBC driver wanted strict standard format.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...