• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JasperReports and databases

 
Tom Sakra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey

So I'm pretty new to JasperReports and iReport, but I've made a report (in iReport) that fetches data from my MySQL
database. However, the problem I'm facing is this:

My MySQL database contains customer numbers, which I don't want to display in my report, but instead I want to display
customer names. Problem is, the names are in an MDB-file (which I have access to by using DSN and JDBC-ODBC), so
how do I access them and fetch the names instead of the number? Both databases contain the customer number for
reference.Is there any way I could use the template report from iReport in Java and do some logic to replace the numbers
with the names?

Edit: I figured out how to resolve my problem. In case anyone is interested, here's how I did it:
Instead of letting JasperReports handle the database connection and all that, I made a new class which implements the
JRDataSource methods for filling a report. Then I just filled the Object[][] with data from my database class. Basically, I
only used iReport to design the report and generate a .jasper-file. Here's how to implement it!
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tom and welcome to Javaranch and thanks for sharing your solution!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic