JDBCXYChartDemo - does it really work with MySQL ?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
zw

JDBCXYChartDemo - does it really work with MySQL ?

Post by zw » Wed Jan 29, 2003 5:31 pm

bash-2.03# java JDBCXYChartDemo
Unable to load column 0 (-1,java.lang.String)
Exception: null

In the code
String sql = "SELECT * from try4;";

In my database,
mysql> select * from try4;
+------------+------+
| mlc_date | x |
+------------+------+
| 01/31/2002 | 2 |
+------------+------+
1 row in set (0.00 sec)


What's wrong ?

Arnaud

Re: JDBCXYChartDemo - does it really work with MySQL ?

Post by Arnaud » Fri Jan 31, 2003 11:25 am

Hello,

I didn't find the file JDBCXYChartDemo.java, but the names indicates me it must be a demo using the JdbcXYDataset Class.

The infos in that class tells us : "[...] the sql query must return at least two columns. The first column will be
* the x-axis and remaining columns y-axis values.
* executeQuery can be called a number of times. [...]'

As it is an XY dataset, the x-axis can be a date-axis.

The error message You get means that the data type of the first column is not a date, but a String : You must not store Your date as a String in Your database but use the date/time type.

David Gilbert

Re: JDBCXYChartDemo - does it really work with MySQL ?

Post by David Gilbert » Fri Jan 31, 2003 5:11 pm

Hi Arnaud,

Thanks for posting that...your answer looks spot on to me.

Regards,

Dave Gilbert

Locked