Jump to content
JasperReports Library 7.0 is now available ×

Convert MySQL ResultSet to JRDataSource - servlet


hamidreza7

Recommended Posts

Hello Friendly and Helpful Forums :)

 

I have a really simply newb question. I java servlet which executes a SQL query and returns a java ResultSet. See below:

Connection conn = ....

Statement stmt = conn.createStatement();

ResultSet rs = stmt.executeQuery(myQuery);

 

(now 'rs' is my ResultSet)

 

I would like fill the data in my jrxml file. I made it in iReports :) All I need is a way to convert the ResultSet type into something like a JRDataSource to pass into the following line of code (as the 'dataSource' variable):

 

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), dataSource);

 

Please make me a happy man by telling me how silly I am and how easy it is. Much obliged!

 

-HRT

Post edited by: hamidreza7, at: 2007/08/15 22:16

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...