One Star

tJava - No suitable driver found for jdbc:postgresql

Hello,
I have a job containing of one component which is a tJava component. In this component I want to do a select on a database then connect to LDAP to get some data and write the gotten data back to the database.
I wrote my code in Eclipse where it is working. When now copying it into the tJava component and trying to run it there, I get the following error:
Exception in component tJava_1
java.sql.SQLException: No suitable driver found for jdbcSmiley Tongueostgresql://localhost/PortalDW
What am I doing wrong or what did I forget to do?
Kind regards
Nadja
7 REPLIES
One Star

Re: tJava - No suitable driver found for jdbc:postgresql

Don't use tJava. Use tdatabasetypeInput and tLDAPInput.
One Star

Re: tJava - No suitable driver found for jdbc:postgresql

I cannot do this, because for the LDAP part I need to use StartTLS and this option is not available in tLDAPInput. But thanks for the suggestion.
Any other ideas?
One Star

Re: tJava - No suitable driver found for jdbc:postgresql

But could you still use the tPostgresInput ?
One Star

Re: tJava - No suitable driver found for jdbc:postgresql

Well I think not, because I need to be able to iterate over the result of the SQL query in tJava because the LDAP query is dependent on the SQL query. And as I found out, tJava has no input. Oh do you have an idea?
Seventeen Stars

Re: tJava - No suitable driver found for jdbc:postgresql

Hi Nadja, Why do you expect the PostgreSQL driver is loaded only by calling an JDBC call?
The components for the databases organizes the driver load, your code does not do this.
You have to load the JDBC driver with tLoadLibrary component (before your own code comes in action).
One Star

Re: tJava - No suitable driver found for jdbc:postgresql

Hi jlolling,
thanks for your reply. I was not aware of the fact that I need to load the library first. That was why I asked. I'm not that familiar with Talend yet and still need some practice. But thanks for the help, this solution works fine for me and solved my issue.
Kind regards
Nadja
Community Manager

Re: tJava - No suitable driver found for jdbc:postgresql

Well I think not, because I need to be able to iterate over the result of the SQL query in tJava because the LDAP query is dependent on the SQL query. And as I found out, tJava has no input. Oh do you have an idea?

You can use tPostgresqlInput for your database part to select record from postgresql database, and use tJavaFlex, instead of tJava, which allows you to access the input data flow and has output data flow. Take a look at this KB article The difference between tJava, tJavaRow and tJavaFlex.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business