Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Properties file vs ktr file

  1. #1
    Join Date
    Oct 2013
    Posts
    3

    Default Properties file vs ktr file

    This is all in a non-Repository scenario.

    Looking at a ktr file, it contains connection info in the <connection> section.

    in the .kettle/ folder, there is a kettle.properties file and a shared.xml file (which contains the shared database connection info).

    Is there some way to use either the kettle.properties file and/or the shared.xml file to override the connection info in the .ktr file? That way, if I have multiple transformation files, I need to change only one place (either the properties file or the shared.xml file) to make a db connection to point elsewhere.

    I am trying to avoid changing multiple ktr files when I need to point to a different DB.

  2. #2
    Join Date
    Nov 2008
    Posts
    777

    Default

    Here are my thoughts on this:
    1. Don't edit shared.xml unless it gets corrupted or something.
    2. In Spoon when you have a ktr file open, you can see all your database connections in the "View" tab under the "Database connections" grouping. The connections in "bold" are the shared ones.
    3. When you right-click on a non-shared connection and select "Share", that connection will be copied into shared.xml. All ktr files with that connection name will use the version of the connection in shared.xml and overwrite whatever is in the ktr file. Editing a shared connection with one ktr file open will thus effectively change the shared connection for every other ktr file that uses that shared connection.
    4. When you right-click on a shared connection and select "Stop sharing", that connection will be removed from shared.xml. At that point, all ktr files with the once-shared connection will now use whatever is in the ktr file.
    5. The best way, I think, to use the two files (shared.xml and kettle.properties) in concert is to define a somewhat "generic" shared connection (one with kettle variables for host name, port, database name, user name, password) and then define those variables in kettle.properties. That way, the shared connection rarely needs to be changed and the database can be redirected by changing the variables - which can be done by 1) editing kettle.properties, 2) overriding them on the Spoon "Launch" screen in the "Variables" section, or 3) on the Pan command line. There may be other ways as well.
    pdi-ce-4.4.0-stable
    Java 1.7 (64 bit)
    MySQL 5.6 (64 bit)
    Windows 7 (64 bit)

  3. #3

    Default

    You might want to check out using JNDI. You can specify the connection parameters as a JNDI connection, which can then be changed in just one location when it needs to change. It is also machine specific, which is why we're using it - we can copy all of our jobs/transformations to another machine and just specify a different database using JNDI.

    It is a little bit of a mess to set up. I had to dig into the Pentaho documentation to get it working correctly.

Tags for this Thread

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.