• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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: 3285
13
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!!
 
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic