Jump to content
We've recently updated our Privacy Statement, available here ×

connect to MySQL database


Recommended Posts

By: Umar Khatab - intercitra

connect to MySQL database

2003-10-30 19:08

I'm currently trying to run Jasper Report and integrate it with the rest of my Tomcat webapp which has already been working.

 

I've run the JasperReport samples, and they work.

Now the problem is that it seem difficult for me to integrate it with the webapp.

 

I have a few questions here.

 

[1]

 

File reportFile = new File(application.getRealPath("/frontpage/report/reports/WebappReport.jasper"));

String nama = request.getParameter("name");

String komentar = request.getParameter("comment");

 

Map parameters = new HashMap();

 

parameters.put("ReportTitle", "Backend User List");

parameters.put("BaseDir", reportFile.getParentFile());

parameters.put("Name", nama);

parameters.put("Comment", komentar);

................

 

 

I put two new parameters ("Name" and "Comment") in the sample to test whether they could show up in the report. If I enter the values like I show above, they won't show up in the pdf.

 

 

parameters.put("ReportTitle", "Backend User List");

parameters.put("BaseDir", reportFile.getParentFile());

parameters.put("Name", "MyName");

parameters.put("Comment", "MyComment");

................

 

But If I hardcode the values that way, they'll show up. I've tested that the values are already stored in variables 'nama' and 'komentar'. I've also tested, after putting the values in the Hashmap, to get the values back, and they show up.

 

I use the WebappReport.xml (also from samples). I've put this following lines in the parameters section:

 

<parameter name="Name" class="java.lang.Object"/>

<parameter name="Comment" class="java.lang.Object"/>

 

and the textfields as well.

 

 

Briefly speaking, the values of the parameters can only show up If they're hardcoded.

 

Anyone please point me out and correct my mistake.

 

[2] Please show me how to make a connection to MySQL database.

 

 

 

 

By: supportsib - supportsib

RE: connect to MySQL database

2004-03-11 01:30

how did u connect with mysql

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...