Results 1 to 8 of 8
Thread: Java Reports
- 07-09-2011, 12:46 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 8
- Rep Power
- 0
- 07-09-2011, 01:30 PM #2
Hi. Do you have strong require about using Oracle Report? More widely solve to use Jasper Report or Birt Report. I prefer Birt Report.
Skype: petrarsentev
http://TrackStudio.com
- 07-09-2011, 01:48 PM #3
Member
- Join Date
- Jul 2011
- Posts
- 8
- Rep Power
- 0
Thank you v much. I asked this question on several forums , mostly on Daniweb but they all are idiots havnt answered a single question to the point. Your reply is thousand times useful for me. I am going to give it a try.
- 07-09-2011, 06:46 PM #4
Member
- Join Date
- Jul 2011
- Posts
- 8
- Rep Power
- 0
How can i call A report made in Birt from JAVA SE application?
- 07-10-2011, 10:48 AM #5
yes of course. see that java - birt in a desktop application - Stack Overflow
The Eclipse has special build for create birt report. You can use it.Skype: petrarsentev
http://TrackStudio.com
- 07-11-2011, 03:11 PM #6
Member
- Join Date
- Jul 2011
- Posts
- 8
- Rep Power
- 0
Java Code://----------- Code for Test Class --------------------------- import java.io.IOException; import org.eclipse.birt.report.engine.api.EngineConfig; import org.eclipse.birt.report.model.api.DataSetHandle; import org.eclipse.birt.report.model.api.DesignElementHandle; import org.eclipse.birt.report.model.api.DesignEngine; import org.eclipse.birt.report.model.api.DesignFileException; import org.eclipse.birt.report.model.api.ElementFactory; import org.eclipse.birt.report.model.api.OdaDataSetHandle; import org.eclipse.birt.report.model.api.OdaDataSourceHandle; import org.eclipse.birt.report.model.api.PropertyHandle; import org.eclipse.birt.report.model.api.ReportDesignHandle; import org.eclipse.birt.report.model.api.SessionHandle; import org.eclipse.birt.report.model.api.SlotHandle; import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.api.elements.structures.ComputedColumn; public class test { private PropertyHandle computedColumns = null; private SessionHandle sessionHandle; private ReportDesignHandle reportDesignHandle; private ElementFactory elementFactory; private DesignElementHandle designElementHandle; private OdaDataSourceHandle odaDataSourceHandle; private OdaDataSetHandle odaDataSetHandle; private EngineConfig engineConfig; private String reportFileName = null; private String dataSrc = null; private String dataSet = null; /* * Constructor saves away report design file name, data source and data set info * @param: * fileName: Name of report design file * dataSrc: Name of data source * dataSet: Name of data set */ test (String fileName, String dataSrc, String dataSet) { this.reportFileName = fileName; this.dataSrc = dataSrc; this.dataSet = dataSet; } /* * Initializes the variables */ @SuppressWarnings("deprecation") public void Initialize () { // Setup config (assumes Eclipse installed in c:\eclipse engineConfig = new EngineConfig( ); engineConfig.setEngineHome ("F:\\Birt Report\\workspace"); // Create a session handle. This is used to manage all open designs. // Your app need create the session only once. sessionHandle = DesignEngine.newSession(null); // Open a report design. try { reportDesignHandle = sessionHandle.openDesign(reportFileName); } catch (DesignFileException e) { e.printStackTrace(); } // The element factory creates instances of the various BIRT elements. elementFactory = reportDesignHandle.getElementFactory(); return; } /* * Connects to specified data source and data set */ public void connectDS () { String tmp; int ii; SlotHandle sloth = reportDesignHandle.getDataSources(); java.util.Iterator iter = sloth.iterator(); // Search for specified data source while (iter.hasNext() == true) { odaDataSourceHandle = (OdaDataSourceHandle) iter.next(); tmp = odaDataSourceHandle.getName(); if (tmp.compareTo(dataSrc) == 0) break; } // Search for specified data set sloth = reportDesignHandle.getDataSets(); iter = sloth.iterator(); while (iter.hasNext() == true) { odaDataSetHandle = (OdaDataSetHandle) iter.next(); tmp = odaDataSetHandle.getName(); if (tmp.compareTo(dataSet) == 0) break; } return; } /* * @param * colName: Name of the computed column * colExpr: Expression for the computed column */ public void addComputedColumn (String colName, String colExpr) throws IOException, SemanticException { // Create a computed column ComputedColumn newColumn = new ComputedColumn(); newColumn.setName(colName); newColumn.setExpression(colExpr); computedColumns = odaDataSetHandle.getPropertyHandle (DataSetHandle.COMPUTED_COLUMNS_PROP); computedColumns.addItem(newColumn); return; } /* * Saves the changes to a report design file */ public void saveReport () { // Save the design and close it. try { reportDesignHandle.saveAs(reportFileName); } catch (IOException e) { e.printStackTrace(); } reportDesignHandle.close (); return; } }Java Code:import java.io.IOException; import org.eclipse.birt.report.model.api.activity.SemanticException; public class main { /** * @param args */ public static void main(String[] args) { test compCol = new test ("Company.rptdesign", "Data Source", "Company"); compCol.Initialize(); compCol.connectDS(); try { compCol.addComputedColumn("CA", "if (row[\"State\"] == \"CA\") {row[\"CA\"] = 1;}"); } catch (SemanticException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } compCol.saveReport(); } }
This is my code... I have downloaded birt made a simple Report according to data and use the code to connect but i m getting following error.
I am sure the location of file is exact... I am acessing it through a desktop app without any server or engine (Tomcat etc...)Java Code:Jul 11, 2011 6:05:45 PM org.eclipse.birt.report.model.parser.ModuleReader readModule SEVERE: Parsed file was not found. Error.DesignFileException.SYNTAX_ERROR - 1 errors found! 1.) org.eclipse.birt.report.model.parser.DesignParserException (code = Error.DesignParserException.FILE_NOT_FOUND, message : The file "Company.rptdesign" is not found.) at java.io.FileInputStream(null:-2) at java.io.FileInputStream(null:-1) at java.io.FileInputStream(null:-1) at sun.net.www.protocol.file.FileURLConnection(null:-1) at sun.net.www.protocol.file.FileURLConnection(null:-1) at java.net.URL(null:-1) at org.eclipse.birt.report.model.parser.ModuleReader(ModuleReader.java:207) at org.eclipse.birt.report.model.parser.DesignReader(DesignReader.java:143) at org.eclipse.birt.report.model.core.DesignSessionImpl(DesignSessionImpl.java:242) at org.eclipse.birt.report.model.core.DesignSessionImpl(DesignSessionImpl.java:218) at org.eclipse.birt.report.model.api.SessionHandleImpl(SessionHandleImpl.java:224) at test(test.java:63) at main(main.java:13) at org.eclipse.birt.report.model.parser.ModuleReader.readModule(ModuleReader.java:221) at org.eclipse.birt.report.model.parser.DesignReader.read(DesignReader.java:143) at org.eclipse.birt.report.model.core.DesignSessionImpl.openDesign(DesignSessionImpl.java:242) at org.eclipse.birt.report.model.core.DesignSessionImpl.openDesign(DesignSessionImpl.java:218) at org.eclipse.birt.report.model.api.SessionHandleImpl.openDesign(SessionHandleImpl.java:224) at test.Initialize(test.java:63) at main.main(main.java:13) Exception in thread "main" java.lang.NullPointerException at test.Initialize(test.java:69) at main.main(main.java:13)
- 07-11-2011, 06:52 PM #7
Member
- Join Date
- Jul 2011
- Posts
- 8
- Rep Power
- 0
It Solved.... Thanx Petr for your vvvvvvvvvvvvvvvv kind suggestion....I dont know how to repay u.....
Thanx again , this forum and u are the best.
- 07-12-2011, 08:29 AM #8
Member
- Join Date
- Jul 2011
- Posts
- 8
- Rep Power
- 0
Similar Threads
-
Call jasper Reports from java
By suresh_m5a5@yahoo.co.in in forum New To JavaReplies: 1Last Post: 06-18-2012, 08:54 AM -
The first version of a reporting tool Stimulsoft Reports.Fx for Java is released
By Andrew1000 in forum Java SoftwareReplies: 0Last Post: 06-24-2011, 08:24 AM -
Need help creating a simple native Java application with a database and reports
By MrSnrub in forum EclipseReplies: 0Last Post: 05-13-2011, 03:17 AM -
help with calling jasper reports from java code (am using netbeans)
By sj_1188 in forum NetBeansReplies: 9Last Post: 12-21-2010, 02:37 PM -
What to use for Pdf reports?
By hari.kr in forum Advanced JavaReplies: 2Last Post: 04-29-2010, 11:15 AM


1Likes
LinkBack URL
About LinkBacks
Hello to all... I am doing a college project and i want to connect java with oracle reports or any other to take out the reports... I already made report but dont know how to call from java... Please share any idea.
Reply With Quote
Bookmarks