Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: How to use JNDI url of BIRT

  1. #1
    Join Date
    Jan 2006
    Posts
    6

    Default How to use JNDI url of BIRT

    Im working in BIRT now. I have to use a same data source for all reports that i generate.If i change the database name or username or password it should reflect in all reports.

    I used the xml datasource.But it is asking the report parameters every time for drivername, username,etc.., I want to use the JNDI url. I dont know how to use this. What value should i give in the JNDI url field in new data source. Please guide me how to use the JNDI url. I have no idea about it.So please guide me in detailed manner.

  2. #2
    Join Date
    Nov 1999
    Posts
    579

    Default Re:How to use JNDI url of BIRT

    Sorry, but BIRT doesn't support JNDI. The JFreeReport component however does. I suggest you try to duplicate your reports using either the Report Design Wizard (simple reports) or the Report Designer (more complex layouts).

    Take care,

    Marc

  3. #3
    Join Date
    Jan 2006
    Posts
    6

    Default Re:How to use JNDI url of BIRT

    But ,im using the BIRT2.1.1. In that whilw we create a datasource there is an option name JNDI url. What is the use of it? Could u please tell me?

  4. #4

    Default

    BIRT 2.1 and up does support JNDI, see:

    http://www.eclipse.org/birt/phoenix/...2.1.php#jump_4

    We've been using JNDI from BIRT a different way: we have scripted data-sources backed by Java classes for some of our BIRT reports, and each data-source takes a parameter for a JDBC URL to use. If that parameter is not specified, it looks up a connection in JNDI. The code to do that is really simple:

    Code:
          try {
            Context ctx = new InitialContext();
            DataSource dsrc = (DataSource) ctx.lookup( "java:/SampleData" );
            con = dsrc.getConnection();
          } catch (NamingException ex) {
    No other configuration is needed; it just picks up a pooled connection from JBoss.

  5. #5
    Join Date
    Jun 2008
    Posts
    1

    Default How to use JNDI url of BIRT

    We are using 2.2.2 version.
    Suposing we can only use JNDI data source, where must i add that piece of code, into a report element or adding to an specific or a preexisting java class?

  6. #6
    Join Date
    Mar 2008
    Posts
    15

    Default

    I just now was able to use jndi for birt reports.

    This is what I did.

    1. drop driver jar (jtds.jar in my case) in tomcat/common/lib.
    2. add a resource either in tomcat/conf/context.xml or tomcat/webapps/pentaho/META-INF/context.xml

    Code:
            <Resource
                name="jdbc/fooDB"
                auth="Container"
                type="javax.sql.DataSource"
                driverClassName="net.sourceforge.jtds.jdbc.Driver"
                url="jdbc:jtds:sqlserver://<server_addy)/<db_name>"
                username="****"
                password="****"
                maxActive="20"
            />
    3. set jndi property in report

    Code:
    java:comp/env/jdbc/fooDB
    references:
    http://wiki.eclipse.org/index.php/BIRT/FAQ/Data_Access
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=131662#c7
    http://tomcat.apache.org/tomcat-5.5-...ces-howto.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.