• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Problem in dataset when linking with mssqlser

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am using cewolf tag libraries in jsps to producing charts. I am using mssql server 2000 to retrieve data dynamically but my server reporting error when retrieving and producing dataset exception
package com.cewolf;
import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;
import java.util.Map;
import java.util.*;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;

import com.sellspace.util.DatabaseConnection;

import de.laures.cewolf.DatasetProduceException;
import de.laures.cewolf.DatasetProducer;
import de.laures.cewolf.links.CategoryItemLinkGenerator;
import de.laures.cewolf.tooltips.CategoryToolTipGenerator;
public class piechart implements DatasetProducer, CategoryToolTipGenerator, CategoryItemLinkGenerator, Serializable {


private static final Log log = LogFactory.getLog(piechart.class);
public Object produceDataset(Map params) throws DatasetProduceException {
log.debug("producing data.");
DefaultCategoryDataset ds = new DefaultCategoryDataset(){
protected void finalize() throws Throwable {
super.finalize();
log.debug(this +" finalized.");
}
};
try {

java.sql.Connection con=DatabaseConnection.getConnection();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select country,siteid from siteownerdetails ORDER BY siteid");



while (rs.next()) {
ds.addValue(rs.getString(1),rs.getInt(2));

}
rs.close();

} catch (SQLException se) {
throw new RuntimeException(se);
}
return ds;
}
public boolean hasExpired(Map params, Date since) {
log.debug(getClass().getName() + "hasExpired()");
return (System.currentTimeMillis() - since.getTime()) > 5000;
}
public String getProducerId() {
return "PageViewCountData DatasetProducer";
}
//public String generateLink(Object data, int series, Object category) {
// return seriesNames[series];
// }
protected void finalize() throws Throwable {
super.finalize();
log.debug(this + " finalized.");
}
/* public String generateToolTip(CategoryDataset arg0, int series, int arg2) {
return seriesNames[series];
}*/
public String generateToolTip(CategoryDataset arg0, int arg1, int arg2) {
// TODO Auto-generated method stub
return null;
}
public String generateLink(Object arg0, int arg1, Object arg2) {
// TODO Auto-generated method stub
return null;
}

}


This is my java file please suggest me how to retrieve data correctly.
Thanks in advance
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What error are you getting? In which line does it occur?

Also, please BeForthrightWhenCrossPostingToOtherSites; it's the right thing to do.
 
vina kum
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for doing this mistake but i want to solve the problem as quick as possible so i did like this any my i am getting the below error when i run the above code:
cewolf-jsessionid-F26DF17402C666E9AA2613AB2A46734A.png
[Thumbnail for cewolf-jsessionid-F26DF17402C666E9AA2613AB2A46734A.png]
error i am getting
 
Everybody's invited. Even this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic