JFreeServlet and SQL

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

JFreeServlet and SQL

Post by Eldar Lyn » Thu Jul 18, 2002 9:48 am

Hi,

i'm actually using JFreeServlet(to generate a xy chart) and i've a little problem with my sql query:

if i use this, no problem:
Select Data1, Data2 From Table

But when i try that:
Select Data1, avg(Data2) From Table Group By Data1

i get a ArrayIndexOutOfBoundsException

How can i correct this?

Bryan

Re: JFreeServlet and SQL

Post by Bryan » Thu Jul 18, 2002 12:31 pm

Elder

I tried the following sql at http://coyote.aad.gov.au/JFreeServlet/example2.html:

set_code, avg(record_count) as Track
from marine.summary_track
group by set_code


Things seemed fine.

A couple of questions:
1. Are you using the downloaded war/jar or from CVS?
2. What DB are you using
3. Can you post the full stack trace
4. Can you send the results of the query
Select Data1, avg(Data2) From Table Group By Data1

Bryan

Eldar Lyn

Re: JFreeServlet and SQL

Post by Eldar Lyn » Thu Jul 18, 2002 2:25 pm

ok, i think i've found my real problem, but i've still not the solution:

My Data1 is in fact the concatenation of two columns

Select Data1_1||Data1_2, avg(Data2) From Table Group By Data1_1||Data1_2

I'm using sorces from CVS, with Oracle

Bryan

Re: JFreeServlet and SQL

Post by Bryan » Fri Jul 19, 2002 12:09 am

Elder

I am still trying to understand your problem. I would still be very interested in seeing the results as displayed from sql plus.


NB I do not think it will make much difference but can you try (This will just add affect displayed labels)

Select Data1_1||Data1_2 as label,
avg(Data2) as Avg_Data
from Table
Group By label

Bryan

Eldar Lyn

Re: JFreeServlet and SQL

Post by Eldar Lyn » Fri Jul 19, 2002 7:57 am

Hi,

i try your query, but i had a "ORA-00904: invalid column name" for the "Group By Label"


For the result in SQL-PLUS, i have this

Query:
Select Data1_1||Data1_2 as label,
avg(Data2) as Average
from Table
Group By Data1_1||Data1_2)

Result:
LABEL AVERAGE
----------- ----------
XA46055 13
XA46060 12
XA46070 21
XA46080 13
XA46090 11
XA47010 14
XA47020 12


For the error i get with JFreeServlet:

java.lang.ArrayIndexOutOfBoundsException
at com.jrefinery.data.JdbcXYDataset.executeQuery(JdbcXYDataset.java:188)
at com.jrefinery.data.JdbcXYDataset.(JdbcXYDataset.java:120)
at com.jrefinery.chart.demo.jdbc.servlet.BaseImageServlet.createXYChart(BaseImageServlet.java:207)
at com.jrefinery.chart.demo.jdbc.servlet.BaseImageServlet.createChart(BaseImageServlet.java:191)
at com.jrefinery.chart.demo.jdbc.servlet.BaseImageServlet.doPost(BaseImageServlet.java:597)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1017)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1115)
at java.lang.Thread.run(Thread.java:536)

Bryan

Re: JFreeServlet and SQL

Post by Bryan » Mon Jul 22, 2002 2:10 am

Eldar

When developing some JdbcXYDataset I did get a lot of java.lang.ArrayIndexOutOfBoundsException errors at varing stages. I had thought I had gotten them all.

I would like to replicate your data and work on a solution. Is it possible to do an oracle export just of the table you are using and email directly to me.

It will be public on coyote as I work on it.

Bryan

Locked