• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Problem in dataset when linking with mssqlser

 
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
 
Rancher
Posts: 43011
76
  • 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
[Thumbnail for cewolf-jsessionid-F26DF17402C666E9AA2613AB2A46734A.png]
error i am getting
 
I would challenge you to a battle of wits, but I see you are unarmed - shakespear. Unarmed tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!