Mysql dynamic query, Java and Jasper report
Actually I have been working on Jasper report. I am using ireport. I have a database in mysql. I am connecting the database to the report in java. Working principle is as follows.
database connectivity-->java file-->export to .pdf file as front end japer report.
Earlier I used to design a static structure of the report. (coulmn names,title etc)Now, I wish to do the same within java itself dynamically. I have been thinking that one can't create columns dynamically without designing on ireport. Now, I want to know, whether there is any mechanism to create new columns and corresponding values as parameters(as arguments) while running the java file. This is what I am trying to implement. Let's take an example.
I have many tables like profile,describtion,schema etc from the database sample. I am selecting name,address, accountNo from these 3 tables respectively. I might be having more tables and correspondning values in the columns. I might select 2 tables and 3 columns or 3 tables 4 columns or many other valid combinations. I want to know, is it possible to achieve such mechanim of dynamic mysql query within jasper report if I have not designed these columns in the .jrxml file. I have many tables. I can not design each and every table on .jrxml file. I believe I am explaning the problem apporpriatly. Pleae do let me know if you know any possible solution.
Thank you in advance. I would welcome your suggestions.
I will edit this post tomorrow and upload whatever I have been trying ASAP.