4

I have a talend job that uses tOracleInput component with connection type of ORACLE CUSTOM. It is working well.

Now, I have a requirement to use jndi as the database connection. Any ideas how can this be achieved?

lorraine batol
  • 6,001
  • 16
  • 55
  • 114
  • 1
    We had a similar requirement years ago. Colleague built a custom component to lookup the JNDI datasource, open and register a shared connection. Because that would fail in the IDE/TOS we usually put a tOracleConnection behind that - to register a "handmade" connection when running outside the container. The later one wont have a valid configuration from the context in production, so there's no risk attached. – Kriegel May 29 '17 at 20:44

2 Answers2

1

First deploy your job as a webservice. After that you should be able to alter the Use or register a shared DB Connection in tOracleConnection. There you can define your JNDI datasource.

Source: https://www.talendforge.org/forum/viewtopic.php?pid=50374#p50374

Hash
  • 4,647
  • 5
  • 21
  • 39
0

The answer that I went with is creating my own custom talend component. Because deploying the talend job as a separate package than the actual web application is kind of, let's say, not an ideal solution in our case.

I have copied the tOracleInput component, and using Talend's component designer, I have added a "Use JNDI" checkbox and "JNDI name" textbox on the component. And modified the javajet files to build the connection from JNDI (InitialContext) using the JNDI name if the checkbox is checked. Else, proceed as usual on tOracleInput codes.

So, whenever I exported my talend job, I would tick the "Use JNDI" checkbox but if I'm just testing within Talend Studio, I would uncheck it and filled up the database properties will be used.

Hope this helps future readers.

Thanks!

**https://intodata.eu/tag/talend/ I have used the 3 part tutorials (on link above) on how to a build custom component to helped me start

lorraine batol
  • 6,001
  • 16
  • 55
  • 114