aspose file tools*
The moose likes Other Open Source Projects and the fly likes Problem in dataset when linking with mssqlser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Problem in dataset when linking with mssqlser" Watch "Problem in dataset when linking with mssqlser" New topic
Author

Problem in dataset when linking with mssqlser

vina kum
Greenhorn

Joined: Jun 24, 2009
Posts: 21
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
Marshal

Joined: Mar 22, 2005
Posts: 41571
    
  54
What error are you getting? In which line does it occur?

Also, please BeForthrightWhenCrossPostingToOtherSites; it's the right thing to do.


Ping & DNS - my free Android networking tools app
vina kum
Greenhorn

Joined: Jun 24, 2009
Posts: 21
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:



[Thumbnail for cewolf;jsessionid=F26DF17402C666E9AA2613AB2A46734A.png]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in dataset when linking with mssqlser