This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Printing sql table data as report in JDBC

 
Ranch Hand
Posts: 38
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to select all the rows from a MySQL table in JDBC.
That I can do using statements, query & resultset.

Then I want to display the output as a report, like we make report in MS Access.
I can't find the way.
Please help.
 
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to look into a reporting software such as Jasper Report to build a template of the report then use sql to populate it.
 
Pritam Chatterjee
Ranch Hand
Posts: 38
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So do I need to install Jasper Report.
Then how will I populate data in it through MySQL.
 
K. Tsang
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm the sql is embed inside the report. If you don't like hard-coding then you probably want to use a view or store procedure.

Yet no matter what approach you use, if the report needs to add or remove a column/field then the report source needs changing (hence the sql too)
 
Pritam Chatterjee
Ranch Hand
Posts: 38
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you share the full code or a good link..
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just search for JasperReports, there's tons of material on its site and elsewhere in the web. It doesn't make sense to give an introduction here when all that is already available. The https://coderanch.com/how-to/java/OtherOpenSourceProjectsFaq also points to introductory material.
 
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!