|
Re: BIRT + JavaBridge Tutorial [message #647098 is a reply to message #647002] |
Tue, 04 January 2011 15:30 |
|
Osu,
Great tutorial and thanks for putting it together. It would be great if
you could create a link to it in the birt exchange devshare.
Jason
On 1/3/2011 5:38 PM, osuwariboy wrote:
> Hello everyone,
>
> Well, first of all I apologize if I'm not posting this in the right
> place but I really had no idea where else to post it. Anyway, the thing
> is that I had a lot of difficulty setting up BIRT to work correctly with
> JavaBridge.
> Since I could not find any clear tutorial on how to do this, I decided
> to create my own, which I posted on youtube. Here are the links for
> whoever is interested:
>
> http://www.youtube.com/watch?v=79aXbyx52kY
> http://www.youtube.com/watch?v=fb5iSBrw6O4
>
> Also, and this is mainly why I've created this post, in my video, I'm
> giving credit to Jason Weathersby who helped me set things right once
> and for all. Should this pause any sort of problem with you then just
> say the word and I shall remove the videos immediately.
>
> Thanks a lot everyone and have a good viewing ;).
>
> Osu
|
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #647143 is a reply to message #647131] |
Tue, 04 January 2011 17:46 |
|
Osu,
Where you posted it is perfect. BTW you did pronounce my name correctly.
Thanks again
Jason
On 1/4/2011 12:09 PM, osuwariboy wrote:
> Hey Jason,
>
> Thanks for the suggestion, I've done just that and posted the link in
> the BIRT exchange "Deploying and Integrating BIRT Report Engine in
> Applications" section (I hope that's the place you had in mind when you
> mentioned the BIRT exchange devshare if not well, just point me in the
> right direction ;) ).
>
> I sincerely hope some people will find it useful and also, feel free to
> give the link to the videos to whoever you feel might need it.
>
> Thanks again for your assistance :).
>
> Osu
>
> P.S. Did I get your name right? English not being my mother language, I
> sometimes have tiny bits of pronounciation problems ;)
|
|
|
Re: BIRT + JavaBridge Tutorial [message #647145 is a reply to message #647137] |
Tue, 04 January 2011 17:56 |
|
Ok, the webmaster should be able to get it fixed.
Jason
On 1/4/2011 12:49 PM, osuwariboy wrote:
> Okay, I've posted my article at the right place this time... but you get
> an error 404 when you try to access it. I've contacted the webmaster to
> see what went wrong. That's really too bad :(
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #648216 is a reply to message #647160] |
Tue, 11 January 2011 20:15 |
Eclipse User |
|
|
|
Originally posted by: Holger.Buchner.Googlemail.com
Am 04.01.2011 20:44, schrieb osuwariboy:
> Okay, I figured out what was wrong with the link... it was because I put
> the caracter "+" in my post title. Once removed, everything worked
> properly.
Dear osuwariboy,
very interesting recording. Thanks for putting that together.
your,
Holger
|
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #705259 is a reply to message #705238] |
Fri, 29 July 2011 16:08 |
|
Karvesh,
I will try to upgrade the integration to 3.7 next week. BIRT 3.7 is a
POJO runtime and does not use OSGi so it will be different.
Jason
On 7/29/2011 11:42 AM, karvesh wrote:
> I downloaded the Birt Engine 2.6.1 eventually
> Its working! awesome!
> Thanks a lot..
> As you said: "it was not easy to know but once you know its easy" :)
|
|
|
Re: BIRT + JavaBridge Tutorial [message #705311 is a reply to message #705259] |
Fri, 29 July 2011 17:29 |
|
Karvesh,
I went ahead and tried to run the php java bridge with BIRT 3.7. It
works fine. So I updated this page to show what I did to get it to work
with BIRT 3.7:
http://www.birt-exchange.org/org/devshare/deploying-birt-reports/743-calling-birt-from-php/
Look in the writeup for the upgrade instructions for BIRT 3.7.
Jason
On 7/29/2011 12:08 PM, Jason Weathersby wrote:
> Karvesh,
>
> I will try to upgrade the integration to 3.7 next week. BIRT 3.7 is a
> POJO runtime and does not use OSGi so it will be different.
>
> Jason
>
> On 7/29/2011 11:42 AM, karvesh wrote:
>> I downloaded the Birt Engine 2.6.1 eventually
>> Its working! awesome!
>> Thanks a lot..
>> As you said: "it was not easy to know but once you know its easy" :)
>
|
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #707332 is a reply to message #705709] |
Mon, 01 August 2011 14:09 |
|
Karvesh,
You should see 12 php files related to running BIRT reports.
For example PhpRunAndRenderPDF.php
In that example we get the current location like:
$here = getcwd();
and then open a specific report
$report =
$birtReportEngine->openReportDesign("${here}/TopNPercent.rptdesign");
Jason
On 7/30/2011 3:59 AM, karvesh wrote:
> Dear Jason
>
> Thanks a lot for the reply. I will try it eventually with the version 3.7.
> I have one question for the moment. It concerns the file report.php in
> the JavaBridge folder.
> When I open the file, i see that there is a code:
> $myReport = "test.rptdesign";
>
> This means that the test report file will be rendered. That is fine. My
> question may sound naive, but even if i change the code to say:
> $myReport = "MyNewReport.rptdesign";
>
> the browser still renders the test.rptdesign report, unless i rename
> MyNewReport.rptdesign to test.rptdesign within the folder itself.. Is it
> because the file has been compiled somewhere and it cannot be modified?
>
> In fact, I am asking this question because i now want to plug in the
> codes in my php web app and call different reports at will..
>
> Could you please hint me here Jason?
>
> Thanking you in advance..
>
>
|
|
|
Re: BIRT + JavaBridge Tutorial [message #707352 is a reply to message #707332] |
Mon, 01 August 2011 14:44 |
karvesh ghunsam Messages: 95 Registered: July 2011 |
Member |
|
|
Dear Jason
Thanks for the reply.
Its ok. Once I got it hosted on my apache web server, it is working all fine.
The BIRT engine has successfully been integrated with my current php application.
It is now possible to view reports within an iframe generated with parameters passed from within the php code itself.
Also i notice it is much faster that using the classic BIRT viewer..
Since there is no frameset similar to the classic BIRT Viewer, i had to write JScript code to handle the export to php, xls, doc and page by page navigation.
I had to create the rptdocument file first and then call the function below to skip to pages
$task->setPageRange("$pageToGo-$pageToGo")
I noticed one thing though: each time i start my Tomcat server and i call a report for the first time, i get a time out.
Also, occassionally, when i run reports after reports intensively for testing, i get a bug report within my iframe:
Fatal error: protocol error: ,Invalid document end at col 94. Check the back end log for OutOfMemoryErrors. in C:\wamp\www\RSSB\BIRT\JavaBridge\java\Java.inc on line 869
I have to restart tomcat and it gets back to normal. Any clue why?
Nevertheless, i am immensely grateful to you and your team. Integrating a powerful reporting engine with php has been a real challenge and its worderful that its now available. Thanks a lot Jason.
I am still testing on Birt 2.6.2. Once i got all the reports done I will switch back to the 3.7 version.
Thanks in advance
Karvesh
|
|
|
Re: BIRT + JavaBridge Tutorial [message #707369 is a reply to message #707352] |
Mon, 01 August 2011 14:55 |
|
On tomcat make sure you have the jvm parameter -XX:MaxPermSize=256M is
set. I set mine in the catalina.bat file. When BIRT first starts up it
takes a some time to startup the platform. This is probably the issue
on the first report. BIRT 3.7 should be much quicker on startup time.
Jason
On 8/1/2011 10:44 AM, karvesh wrote:
> Dear Jason
>
> Thanks for the reply.
> Its ok. Once I got it hosted on my apache web server, it is working all
> fine.
> The BIRT engine has successfully been integrated with my current php
> application.
> It is now possible to view reports within an iframe generated with
> parameters passed from within the php code itself. Also i notice it is
> much faster that using the classic BIRT viewer..
>
> Since there is no frameset similar to the classic BIRT Viewer, i had to
> write JScript code to handle the export to php, xls, doc and page by
> page navigation.
> I had to create the rptdocument file first and then call the function
> below to skip to pages
>
> $task->setPageRange("$pageToGo-$pageToGo")
>
> I noticed one thing though: each time i start my Tomcat server and i
> call a report for the first time, i get a time out. Also, occassionally,
> when i run reports after reports intensively for testing, i get a bug
> report within my iframe:
>
> Fatal error: protocol error: ,Invalid document end at col 94. Check the
> back end log for OutOfMemoryErrors. in
> C:\wamp\www\RSSB\BIRT\JavaBridge\java\Java.inc on line 869
>
> I have to restart tomcat and it gets back to normal. Any clue why?
>
> Nevertheless, i am immensely grateful to you and your team. Integrating
> a powerful reporting engine with php has been a real challenge and its
> worderful that its now available. Thanks a lot Jason.
>
> I am still testing on Birt 2.6.2. Once i got all the reports done I will
> switch back to the 3.7 version.
>
> Thanks in advance
> Karvesh
>
>
|
|
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #707385 is a reply to message #707378] |
Mon, 01 August 2011 15:23 |
|
That is correct.
On 8/1/2011 11:20 AM, karvesh wrote:
> Dear Jason
>
> I have tried at least 100 times with all reports and parameters. It is
> all stable and solid. The out of memory issue seems resolved now.
> Great!
> During the week i will attempt to switch to the 3.7 version.
> Just one question, the folders sessionChartImages and reportDocuments
> where files are created according to the session of the application, I
> guess I will need to create a batch file that automatically cleans them
> from time to time...
>
> Thanks..
>
> Karvesh
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #713587 is a reply to message #710935] |
Mon, 08 August 2011 15:56 |
|
Karvesh,
You could always call the data extract api yourself. Here is an example
with very little error checking.
<?php
define ("JAVA_HOSTS", "127.0.0.1:8080");
define ("JAVA_SERVLET", "/JavaBridge/JavaBridge.phpjavabridge");
$pth = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$path_parts = pathinfo($pth);
require_once("java/Java.inc");
session_start();
$here = getcwd();
$ctx = java_context()->getServletContext();
$birtReportEngine =
java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx);
java_context()->onShutdown(java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook());
try{
$document = $birtReportEngine->openReportDocument($here .
"/reportDocuments/" . session_id() . "/mytopnreportdocument.rptdocument");
$task = $birtReportEngine->createDataExtractionTask($document);
$task->selectResultSet( "NewChart" );
$iExtractResults = $task->extract();
$iData = $iExtractResults->nextResultIterator( );
while ($chk = $iData->next()) {
if( $chk->toString() == "false" ){
break;
}
echo "<br/>";
echo $iData->getValue(1) . " " . $iData->getValue(0);
}
$iData->close();
$document->close();
$task->close();
} catch (JavaException $e) {
echo $e; //"Error Calling BIRT";
}
echo $outputStream;
?>
In the above case the must be a chart in the rptdocument that is named
NewChart. The above example only returns the first two columns.
Jason
On 8/5/2011 11:38 AM, karvesh wrote:
> Dear Jason
>
> I have a question regarding the export data functionality. In the web
> viewer, there is an export data option where we can export the data from
> the dataset element whilst specifying the data type of the column too.
>
> Is there a similar function in the php bridge as well?
>
> Thanking you in advance
>
> Karvesh
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #713959 is a reply to message #713940] |
Tue, 09 August 2011 13:40 |
|
Data extraction even in the BIRT viewer is always based on report items
not data sets. So if your data set is tied to a table you extract the
table and you will get the data. Naming the report item just makes this
easier.
Jason
On 8/9/2011 8:53 AM, karvesh wrote:
> Dear Jason
>
> you mean i actually need to create a chart in the report in order to
> extract the data?
> Is it not possible to extract the dataset directly?
>
> Sorry for the hassle Jason
>
> Thanks in advance
> Karvesh
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #714000 is a reply to message #713977] |
Tue, 09 August 2011 14:46 |
|
Glad to hear.
Jason
On 8/9/2011 10:05 AM, karvesh wrote:
> Dear Jason
>
> thanks for the hint. I named the table where the dataset was bound and
> it works all fine. I did a little correction to the php code and i
> commented the line at the end:
>
> //echo $outputStream;
>
> Then it works ok.
>
> Thanks again..
>
> Karvesh
|
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #715779 is a reply to message #715338] |
Mon, 15 August 2011 14:27 |
|
Karvesh,
The JSAPI is not open source. It is a commercial feature of Actuate's
iPortal package.
Jason
On 8/13/2011 8:43 AM, karvesh wrote:
> Dear Jason
>
> As mentioned before, i had to write JS + php to navigate across my
> reports pages and export functionality.
>
> I have been looking at the JSAPI. It seems to be powerful and easily
> integrated with php according to an article written by you. I just want
> to know if it is open source or commercial?
>
> I know that it comes with the evaluation version of the iServer, but
> nonetheless, is the JSAPI part open source?
>
> Thanks
> Karvesh
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #717899 is a reply to message #717884] |
Mon, 22 August 2011 16:37 |
|
Are you using connection profiles or just the standard JDBC driver?
Jason
On 8/22/2011 12:03 PM, karvesh wrote:
> Dear Jason
>
> I have a question regarding the path of the jar file mysql connector in
> the BIRT report. I was deploying the reports at the client site and when
> i tested the reports there i noticed that they were not connecting with
> the database. After some searching, i noticed in the xml view of the
> reports that the path to the mysql connector was set absolutely to the
> location of the jar file on my machine..
>
> So what i did is that i had to rename the path so that they point to the
> mysql connector jar file on the client server machine. I did it in an
> absolute manner for the moment. I have one question here. What is the
> point of pasting the connector files in the lib folder of the birt
> viewer in the java bridge?
>
> Could you please provide me with any hint or advise as how to set the
> path? Should it be relative?
>
> Thanks in advance
> Karvesh
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #718140 is a reply to message #718012] |
Tue, 23 August 2011 11:39 |
PTPro Messages: 9 Registered: August 2011 |
Junior Member |
|
|
Since I had to make BIRT work with PHP recently I share with you all the sequence of actions and installations I've made.
My computer had Windows XP SP3 with XAMPP installed (no Tomcat or java installed on the machine).
So I've made this:
1. Pre-requirements
1.1. Java runtime and SDK
2. Software to Install
2.1. Activate Tomcat on XAMPP. (NOTE: before starting the tomcat, set environment variable - JAVA_HOME to the java SDK directory).
2.2. Download PHP/Java bridge (At: http://php-java-bridge.sourceforge.net/pjb/download.php - version "Documentation". Paste JavaBridge.war file at <Xampp folder>\tomcat\webapps ahd check installation at http://127.0.0.1:8081/JavaBridge/
2.3. Install Commons Logging (Download at: http://commons.apache.org/logging/download_logging.cgi - Binaries, version.zip). Copy .jar files into <Xampp folder>\tomcat\webapps\birt-viewer\WEB-INF\lib\
2.4. Install BIRT Runtime (Download at: http://download.eclipse.org/birt/downloads/ where says "Latest BIRT runtime Release Build") - copy WebViewerExample folder to <Xampp Folder>\tomcat\webapps\ and rename it to Birt-Viewer.
2.5. Start Apache at XAMPP;
2.6. Start Tomcat at<Xampp Folder>, executing catalina_start.bat
2.7. Test tomcat: http://localhost:8080/ (if something saying tomcat shows, it's ok)
2.8. Test JavaBridge: http://localhost:8080/JavaBridge (if something saying javabridge shows, it's ok)
And that's it, you've got it configured and running, just create your PHP web sites and consume the reports using JavaBridge OR BIRT viewer.
If you just want to render the report, use JavaBridge. If you want to render the report and allow printing and exporting out of the box, use Birt viewer (however you must consider security since the access is http and not by file).
Hope this helps!
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #718202 is a reply to message #718140] |
Tue, 23 August 2011 14:53 |
|
Nice writeup. In the beforeOpen script of the data source for a report
that uses connection profiles you can change the jar location or the
profile location.
For example, if you set the resource folder and place your connection
profile in the resource folder you could use a script like:
if(
!reportContext.getHttpServletRequest().getAttribute("attributeBean").isDesigner()
){
myresourcefolder = reportContext.getDesignHandle().getResourceFolder()
this.setExtensionProperty("OdaConnProfileStorePath",
myresourcefolder+"/mysqlclassic.txt");
}
If you want to change the jar location use
this.setExtensionProperty("jarList", "c:/jars/mydbjar.jar");
You could also put the jar in the resource folder and use the script
above to locate it.
In php set the resource folder like:
$here = getcwd();
$ctx = java_context()->getServletContext();
$birtReportEngine =
java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx);
java_context()->onShutdown(java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook());
try{
//should only be set once will affect all users of the engine
$birtReportEngine->getConfig()->setResourcePath(${here} . "/myresources" );
..
..
..
Jason
On 8/23/2011 7:39 AM, PTPro wrote:
> Since I had to make BIRT work with PHP recently I share with you all the
> sequence of actions and installations I've made.
>
> My computer had Windows XP SP3 with XAMPP installed (no Tomcat or java
> installed on the machine).
>
> So I've made this:
>
>
> 1. Pre-requirements
> 1.1. Java runtime and SDK
>
>
> 2. Software to Install
> 2.1. Activate Tomcat on XAMPP. (NOTE: before starting the tomcat, set
> environment variable - JAVA_HOME to the java SDK directory).
> 2.2. Download PHP/Java bridge (At:
> http://php-java-bridge.sourceforge.net/pjb/download.php - version
> "Documentation". Paste JavaBridge.war file at <Xampp
> folder>\tomcat\webapps ahd check installation at
> http://127.0.0.1:8081/JavaBridge/
> 2.3. Install Commons Logging (Download at:
> http://commons.apache.org/logging/download_logging.cgi - Binaries,
> version.zip). Copy .jar files into <Xampp
> folder>\tomcat\webapps\birt-viewer\WEB-INF\lib\
> 2.4. Install BIRT Runtime (Download at:
> http://download.eclipse.org/birt/downloads/ where says "Latest BIRT
> runtime Release Build") - copy WebViewerExample folder to <Xampp
> Folder>\tomcat\webapps\ and rename it to Birt-Viewer.
> 2.5. Start Apache at XAMPP;
> 2.6. Start Tomcat at<Xampp Folder>, executing catalina_start.bat
> 2.7. Test tomcat: http://localhost:8080/ (if something saying tomcat
> shows, it's ok)
> 2.8. Test JavaBridge: http://localhost:8080/JavaBridge (if something
> saying javabridge shows, it's ok)
>
>
> And that's it, you've got it configured and running, just create your
> PHP web sites and consume the reports using JavaBridge OR BIRT viewer.
>
> If you just want to render the report, use JavaBridge. If you want to
> render the report and allow printing and exporting out of the box, use
> Birt viewer (however you must consider security since the access is http
> and not by file).
>
> Hope this helps!
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #735286 is a reply to message #718202] |
Tue, 11 October 2011 12:35 |
karvesh ghunsam Messages: 95 Registered: July 2011 |
Member |
|
|
Dear Jason
I am having some problem to pass date parameters from php to birt via the javabridge.
I have declared a parameter in birt of datatype date. Then in my php code i am trying:
$task->setParameterValue("paramDtFrom", new java("java.util.Date", $DTFROM));
However, i am getting an exception error. Then i looked at the Java.inc file in the java bridge where the data types are declared and found the following piece of code:
function __call($method,$args) {
$client=$this->__client;
$sig="@{$this->__signature}@$method";
$len=count($args);
$args2=array($this->__java);
for($i=0; $i<$len; $i++) {
switch(gettype($val=$args[$i])) {
case 'boolean': array_push($args2,$val); $sig.='@b'; break;
case 'integer': array_push($args2,$val); $sig.='@i'; break;
case 'double': array_push($args2,$val); $sig.='@d'; break;
case 'string': array_push($args2,htmlspecialchars($val,ENT_COMPAT)); $sig.='@s'; break;
case 'array':$sig="~INVALID"; break;
case 'object':
if($val instanceof java_JavaType) {
array_push($args2,$val->__java);
$sig.="@o{$val->__signature}";
}
else {
$sig="~INVALID";
}
break;
case 'resource': array_push($args2,$val); $sig.='@r'; break;
case 'NULL': array_push($args2,$val); $sig.='@N'; break;
case 'unknown type': array_push($args2,$val); $sig.='@u'; break;
default: throw new java_IllegalArgumentException($val);
}
Does that mean that date data types cannot be passed via the javabridge?
Should i pass them as string values rather?
Thanks in advance..
Karvesh
|
|
|