JDBC Column error using multiplication

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

JDBC Column error using multiplication

Post by Steve Grusak » Tue Oct 01, 2002 3:14 pm

I needed to use a pivot table (identity matrix basically) to transpose a select query result into the proper categories/series needed to display a particular graph. The query returns the correct result. However, I am getting the following error "Unable to load column 1(-5)" which is occuring due to select statment returning a BIGINT type. Actually I get the error above for each column that results based on the value of "cWeek". See the code fragment below:

// Build the select query based on the number of periods that have passed
String sql = new String("select c.name");
for (int i=1;i<=cWeek;i++ )
sql += (", sum(t.meeting_time * p.p"+i+") \"P"+i+"\"");

sql += " from characters as c, pivot_periods as p " +
"inner join teamdynamic as t on " +
"c.character_id = t.member_id " +
"where p.period = t.time_period group by c.character_id";

// Resulting query will be something like:
//
// SELECT c.name, sum(t.meeting_time *p.p1) "P1"
// FROM characters AS c, pivot_periods AS p
// INNER JOIN teamdynamic AS t ON
// c.character_id = t.member_id
// WHERE p.period = t.time_period
// GROUP BY c.character_id;

dataSet.executeQuery( sql );
JFreeChart chart3 = ChartFactory.createStackedVerticalBarChart(
"Meeting Time Used", // chart title
"Period", // domain axis label
"Time", // range axis label
dataSet, // data
true // include legend
);

I changed the SQL to create a view first and then performed a "select * from tmpview" but received the same result. It did allow me to view the column type ... which turned out to be a BIGINT. Apparently the package has not allowed for BIGINT. I could not find the source code to the Jdbc stuff to fix it myself ... I am using the JFreeChart 0.9.3/ JCommon 0.7.0 version set.

I can execute this same query with another JDBC interface then pull the records out one by one and feed them back into JFreeChart ... but I would rather not. Is there another way around this??? Can I get the JDBC source so I can fix it myself? Thanks.

Steve Grusak

Steve Grusak

Re: JDBC Column error using multiplication

Post by Steve Grusak » Tue Oct 01, 2002 5:04 pm

Found the source. Changed JDBCCategoryDataset.java to include BIGINT in two different sections. Recomiled and now everything is working - though I might need to update the other JDBCxxxDataset files as well. I would like to request that "BIGINT" is added to all the JDBCxxxDataset routines in the next release - thanks.

Steve Grusak

David Gilbert

Re: JDBC Column error using multiplication

Post by David Gilbert » Tue Oct 01, 2002 11:23 pm

Hi Steve,

Bryan Scott sent me some changes for BIGINT a week or two ago, and these have been committed to CVS. So 0.9.4 (whenever it is released) should work.

Regards,

DG

Locked