This is the second part of the three-part series on how to configure JNDI for the Pentaho Data Integration toolset. In the first part of the PDI JNDI we reviewed how to configure the jdbc.properties file that configures the simple-jndi interface to work. This second part describes how to configure a database connection using the JNDI within Spoon.
As mentioned in Part 1, this post assumes you have correctly downloaded the database vendor's jdbc driver and moved it to the
pdi-install-directory/lib directory. Also, you have to have configured the JNDI values in the
You can only configure a database connection in a PDI project within a job or transformation. This example uses a transformation. Select Ctrl + N (for Linux, Windows) or Cmd + N (Mac) to open a new Transformation. Configuration is through the Pentaho database connection wizard, which can be accessed within Spoon by selecting the View tab from the left pane, right-clicking the Database Connections folder and selecting New from the context menu to start Spoon's database connection wizard.
The connection wizard allows fine grained configuration through the groups of configuration options listed in the left pane. Typically though, unless you are working in a large, clustered infrastructure environment, configurating the general options is all you need to do.
With the General options selected, there are three sections that need to be configured namely:
- Connection Type
- Connection Settings and
- Connection Name
Within the connection type, choose the database that needs to have the connection (the example illustrated is PostgreSQL).
Choose JNDI protocol from the list within the Settings Pane. (Note that the default connection JDBC setting values disappear when JNDI is select as you have already configured them externally). JNDI only requires one setting value, which is the name of the JNDI instance previously configured in Part 1 of this series.
A name has to be provided for your connection. You can choose any name convention you like, however for easier maintenance, make it consistent across connections. (In this example, I have kept the name the same as the JNDI name.
The result of this configuration should look like the connection wizard below.
Once you have entered the configuration described above, click the Test button. If the configuration is correct, you will be notified of a successful connection.
Viewing the database connections tree under the View tab will reveal the newly created JNDI connection.
Of course, I've only covered the happy path, so if you are having issues with establishing a JDNI connection in Pentaha Data Integration, have a look at my PDI JNDI troubleshooting guide.