Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in dataset when linking with mssqlser

 
vina kum
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • 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
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • 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
  • 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
error i am getting
[Thumbnail for cewolf;jsessionid=F26DF17402C666E9AA2613AB2A46734A.png]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic