Solved

Java / Oracle / Reporting / Graphs and Tables / JDBC

Posted on 2007-04-08
13
982 Views
Last Modified: 2008-01-09
Hi everyone,

I am creating a simple Business Intelligence Tool in Java using Eclipse. I only need this tool to get some information off a desired database and then create some graphs and tables (reports).

I can connect to an oracle database and get all the information off of it. But now I need to create the reports. I was told to check some packages on this website :
http://java-source.net/open-source/charting-and-reporting

I took a look at some of the possible packages and decided I would give JFreeChart a try. But the problem is I have no idea how to connect it to my Eclipse application.

I'm reaching the desperate point....


All I need is to create graphs and tables given some data which I get from a database....
Is there a simpler way to do this???

Please Help
0
Comment
Question by:RicardoVGomes
  • 7
  • 3
  • 3
13 Comments
 
LVL 1

Expert Comment

by:gritscbs
ID: 18873263
Crystal Reports isn't free but it connects to Oracle seamlessly and creating charts and graph is very simple.  You can download a 90 day free trial of Crystal Reports to get started.  Just google crystal reports demo.  We call Crystal Reports directly from within our Web Apps.
0
 

Author Comment

by:RicardoVGomes
ID: 18873473
So you mean that by incorporating Crystal Reports to my system, I could create a report with a click of a button on my application?

Say a user could choose two columns from a database in my application and crystal reports would just make a report(graph) say in jpeg?
0
 
LVL 1

Expert Comment

by:gritscbs
ID: 18873586
Crystal Reports (CR) connects directly to Oracle.  You then use CR to create your reports, graphs, charts, etc.,  it is very intuitive.  You can drag and drop Oracle columns onto your report and then have CR create charts and graphs from those column totals.  Reports can be run directly from CR or called  in several different ways including from a command line.  

We write Oracle based applications and then use CR as our reporting engine.  We use an oracle table to maintain the available reports.  Our reports user interface then list the available reports with the report name being linked to the report.  When a user is on a certain Oracle record within our application and clicks on the report name we pass the record key to CR when calling the report.  

This may be overkill for what you are doing but if you want the ability to create unlimited reports, charts and graphs from any oracle data and give your users a simple interface its hard to beat.  If you want to look at this further I can paste the java code we use to call the reports.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:RicardoVGomes
ID: 18875086
I would need that code please.

And also if you could explain how to connect Crystal Reports to my eclipse project.

Thanks
0
 
LVL 8

Expert Comment

by:n_sachin1
ID: 18875328
You can probably try out BIRT. Eclipse 3.2 has ready-made plugins for BIRT and best of all, its open source.
regards
Sachin
0
 

Author Comment

by:RicardoVGomes
ID: 18877344
I was thinking of using BIRT in the first place, being free and all...

Can someone explain how I would do this using BIRT????

Once again, all I want is : by clicking a button in my Eclipse project.... I want a report (graph/tables)... using columns from an Oracle database ( which I am already connected to in my project) .
0
 

Author Comment

by:RicardoVGomes
ID: 18879527
I've been looking into BIRT.... and by what I understand... I can't do what I wanted...
creating reports from my project... and not from BIRT...

anyone have possible solutions?

please help, reaching desperate phase
0
 
LVL 1

Expert Comment

by:gritscbs
ID: 18879827
This is the main section of code we use for CR integration into our applications if you still want to look into using CR.

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="com.crystaldecisions.report.web.viewer.*"%>
<%@page import="com.grits.JRCHelperSample" %>
<%@page import="com.crystaldecisions.reports.sdk.ReportClientDocument" %>
<%@page import="com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase" %>
<%@page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSource"%>
<%@page import="com.crystaldecisions.sdk.occa.report.application.OpenReportOptions"%>
<%
try {
    String storedReportName = (String)session.getAttribute("reportName");
    String reportName = (request.getParameter("reportName") != null ? request.getParameter("reportName") : storedReportName);
    String storedParams = (String)session.getAttribute("params");
    String params = (request.getParameter("params") != null ? request.getParameter("params") : (storedParams == null ? "" : storedParams));
    boolean clearReport = (request.getParameter("clr") != null ? true : false);
    ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);
    //CrystalReportViewer viewer  = (CrystalReportViewer) session.getAttribute("viewer");
   
    if (reportName == null) {
        reportName = storedReportName;
    }
   
    if (clearReport || clientDoc == null || !reportName.equals(storedReportName) || !params.equals(storedParams)) {
   
        clientDoc = null;
        //viewer = null;
   
        // Report can be opened from the relative location specified in the CRConfig.xml, or the report location
        // tag can be removed to open the reports as Java resources or using an absolute path
        // (absolute path not recommended for Web applications).
        clientDoc = new ReportClientDocument();
       
        // Open report
        clientDoc.open("Reports/" + reportName, OpenReportOptions._openAsReadOnly);
   
        // ****** BEGIN CHANGE DATASOURCE SNIPPET ****************  
        String connectString = "jdbc:oracle:thin:@192.168.1.8:1521:ORCL";
        String driverName = "oracle.jdbc.driver.OracleDriver";
        String JNDIName = "jdbc/OSILASDS";
        String userName = "xxxxxxxxxx";
        String password = "yyyyyyyyy";
       
        // Switch all tables on the main report and sub reports
        JRCHelperSample.changeDataSource(clientDoc, userName, password, connectString, driverName, JNDIName);
       
        if (request.getParameter("params") != null) {
            JRCHelperSample.addReportParameters(clientDoc, "", request.getParameter("params"));
        }
   
        // Store the report document in session
        session.setAttribute(reportName, clientDoc);
        session.setAttribute("reportName", reportName);
        session.setAttribute("params", params);
    }
   
    // Create the CrystalReportViewer object
    CrystalReportViewer viewer = new CrystalReportViewer();
    viewer.setOwnPage(true);
    viewer.setOwnForm(true);
    viewer.setHasLogo(false);    
    viewer.setDisplayGroupTree(false);
    viewer.setHasToggleGroupTreeButton(false);
    viewer.setHasViewList(false);
    viewer.setEnableParameterPrompt(true);
    viewer.setPrintMode(CrPrintMode.PDF);
    viewer.setDisplayToolbar(true);
    viewer.setHasPageNavigationButtons(true);
    viewer.setHasRefreshButton(true);
    viewer.setName(reportName);

    //  set the reportsource property of the viewer
    IReportSource reportSource = clientDoc.getReportSource();              
    viewer.setReportSource(reportSource);
   
    // Process the report
    viewer.processHttpRequest(request, response, application, pageContext.getOut());
}
catch (ReportSDKExceptionBase e) {
    pageContext.getOut().write(e.getMessage());
}
%>
0
 

Author Comment

by:RicardoVGomes
ID: 18881407
I took a look, and there is only a 30 day free trial, I would need it for at least 60. But thanks for your help.

I'm thinking BIRT is a possibility. Can anyone help with BIRT?


0
 
LVL 8

Accepted Solution

by:
n_sachin1 earned 500 total points
ID: 18881641
Ricardo,
  Here are some links that can guide you on using BIRT. Are you on Eclipse 3.2 ? If yes, there is a BIRT report designer perspective that you can use to design the reports. Details are present at:
http://www.eclipse.org/birt/phoenix/tutorial/

You can use the BIRT report engine for integration with your java application and bind data to previously designed reports programmatically.
http://www.eclipse.org/birt/phoenix/deploy/
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php

regards
Sachin


0
 

Author Comment

by:RicardoVGomes
ID: 18882993
You can use the BIRT report engine for integration with your java application and bind data to previously designed reports programmatically.

Can you explain how I can do this? step by step ?

0
 
LVL 8

Expert Comment

by:n_sachin1
ID: 18887489
Ricardo, look at the links provided above. There is a step by step process definition to achieve this, with examples.
0
 

Author Comment

by:RicardoVGomes
ID: 18889160
Thanks n_sachin1,
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php

I have downloaded birt-runtime_2_1_2.zip and extracted it.

I have added the iText1.3.jar file into the apropriate plugin directory.

Configuring JDBC drivers.......
Now it asks me to put the driver jar file into a certain directory.... what is this jar file and where do I find it? I can already connect to a database using jdbc_odbc.

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 194
netstat -ano | find "8000" and taskkill /f /pid 2984 3 56
fibonacci ten numbers 4 38
by zero exception 10 40
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question