Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

JasperReports and databases

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tom and welcome to Javaranch and thanks for sharing your solution!!
 
reply
    Bookmark Topic Watch Topic
  • New Topic