Hitachi Vantara Pentaho Community Forums
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Using App Server JNDI

  1. #1
    Join Date
    Mar 2007
    Posts
    26

    Default Using App Server JNDI

    Hi,

    We will be using Kettle from a web application deployed on WebSphere Application server. We've created a datasource in App server for web application to use it.
    In kettle transformations, we want to use the same datasource to insert/update/query database. I've tried exploring JNDI option in SPOON but i can see only "Database name" field enabled. I'm using SPOON 2.5.0-M2 version.
    I definitely feel that such an option would be available in kettle, please let me know what else i need to configure.

    Thanks,

  2. #2

    Default

    As far as I know, the Kettle component of Pentaho suite does not use JNDI/managed datasources. This was probably on-purpose due to the ETL/heavy DB nature of that type of work.

    Other components (obviously the Pentaho Reporting) can use the JDNI/managed datasources.

    usecase: inject 10,000 records into a database. Do you want Kettle to take up all those managed resources away from your application, or have its own database connection (managed by itself specifically for its type of work)?

  3. #3
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Yeah, actually we do support JNDI. Need some configuration, I'll get back to you guys on that one.

  4. #4
    Join Date
    Apr 2007
    Posts
    16

    Default

    Just select JNDI in "Method of Access", then the "Database Name" field becomes your JNDI connection string.
    It works for me.

    The only problem I have though, is that this method makes it a little difficult for doing things in the designer vs. at runtime. Spoon doesn't run within my app server (not possible is it?), so the JNDI connection won't work there. It'll only work at runtime (within my app server).
    In other words, when in Spoon, I want it to use its own connection, but when running in app server, I want to use JNDI.
    Another project I use has a simple, effective solution for this. You specify both configurations, then it'll always try JNDI first, if it fails, then it falls back on the dedicated connection.
    Does that sound like something that should be considered for Kettle?
    My interim workaround is to simply loop over all the steps just before executing the transformation and changing the metadata to suite JNDI.

  5. #5
    Join Date
    Mar 2007
    Posts
    26

    Default

    Hi christoph,

    --> then the "Database Name" field becomes your JNDI connection string.

    How you define JNDI Connection String ? Shouldn't there be two parts to this: Host App Server and JNDI Connection String (ex: jdbc/xyz) ?

    Hi Matt,
    Are you still working on this ?

    Waiting
    Thanks,

  6. #6
    Join Date
    Nov 1999
    Posts
    9,729

    Thumbs up simple-jndi

    In a directory named "simple-jndi" you can place a file called "jdbc.properties".
    The format is as such:

    Code:
    SampleData/type=javax.sql.DataSource
    SampleData/driver=org.hsqldb.jdbcDriver
    SampleData/url=jdbc:hsqldb:hsql://localhost/sampledata
    SampleData/user=pentaho_user
    SampleData/password=password
    Quartz/type=javax.sql.DataSource
    Quartz/driver=org.hsqldb.jdbcDriver
    Quartz/url=jdbc:hsqldb:hsql://localhost/quartz
    Quartz/user=pentaho_user
    Quartz/password=password
    Hibernate/type=javax.sql.DataSource
    Hibernate/driver=org.hsqldb.jdbcDriver
    Hibernate/url=jdbc:hsqldb:hsql://localhost/hibernate
    Hibernate/user=hibuser
    Hibernate/password=password
    Shark/type=javax.sql.DataSource
    Shark/driver=org.hsqldb.jdbcDriver
    Shark/url=jdbc:hsqldb:hsql://localhost/shark
    Shark/user=sa
    Shark/password=
    This information should mirror the content of your datasource files on the app server.
    I'll make sure the sample gets included in 2.5.0.
    This functionality has been in there since October 2006, 2.3.1 maybe, certainly 2.4.0



    All the best,

    Matt
    Last edited by MattCasters; 05-03-2007 at 05:36 AM.

  7. #7
    Join Date
    Apr 2007
    Posts
    16

    Default

    Looks like Matt answered your question. I didn't know it was possible to actually set up a JNDI service within Kettle. I was only thinking in terms of connecting to one. Which is why I was setting up a regular/direct connection in Spoon, then switching them to use JNDI at runtime via the API.
    Obviously Matt's solution is much preferred.

  8. #8
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    It was written by the folks at Pentaho and as such it was shamelessly overlooked in the docs. It will be doc'ed for the 2.5.0 release, due any minute.

    All the best,

    Matt

  9. #9
    Join Date
    Mar 2007
    Posts
    26

    Default

    Thanks Matt.
    Just summarizing my understanding:
    Inorder to run the transformation using JNDI, i've to configure "jdbc.properties" in "simple-jndi" directory. However, when i'll call/execute this transformation from app-server, it will dynamically use the JNDI - Datasource configured in App server. Usage of properties file in "simple-jndi" directory is just a workaround for making it work through SPOON. Right ??

    Harish

  10. #10
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Yes, that's absolutely positively the case.

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.