Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
SncJt
Contributor III
Contributor III

Datasource and Web service

Hi there,

 

There is a thing I would like to be sure, because it is not so clear on the documentation.

 

Here is the documentation :

https://help.talend.com/reader/P98mtIVGCSoGmSITOuxPTw/TSNegZNcYUVGqIlO5M3QGw

 

I have a job, which is a WebService (using a tRestRequest in entrance, tRestResponse in answer, etc...).

This job runs on our runtime (Karaf).

 

I have DB connections in this job, and I have checked the "Specify a datasource alias", with an alias.

The datasource exists and is well defined on Karaf.

 

On the documentation, it is written this : 

This section introduces the use of connection pooling in Jobs with tRouteInput component, which can be started from a Route using the cTalendJob component. Similar use cases and configurations can also be used with ESB data services.

 

Does my Web service will use my data source ? (if everything is well configured of course)

Because it is written that the data source is use with the Routes (tRouteInput) only.

 

Thanks a lot for your answer

 

Labels (3)
17 Replies
Anonymous
Not applicable

Hi, 

thank you for you time, here's what i did:
0683p000009M8KE.jpg

and here's what i got:

0683p000009M8dc.jpg

Anonymous
Not applicable

I *think* I might have figured your issue. What version of MySQL are you using? You say you are using the mariadb-java-client-1.8.0.jar driver. Is this because you are using MariaDB? If so, your blueprint is likely wrong. I cannot test this I'm afraid. If you are using MySQL then you need to know which version you are using. If you are using v5 then you need to run the following command in your runtime....

 

bundle:install mvn:mysql/mysql-connector-java/5.1.18

....then restart all relevant bundles. This should either fix your issue or give you a different error.

 

If you are using MariaDB, you will need to change your blueprint. 

 

My *guess* at what this should be is something like below....

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
default-activation="lazy">

<bean id="mysqlDataSource" class="org.mariadb.jdbc.MariaDbDataSource">
<property name="url" value="jdbc:xxx"/>
<property name="user" value="xxx"/>
<property name="password" value="xxx"/>
</bean>

<bean id="dataSource" class="org.apache.commons.dbcp.datasources.SharedPoolDataSource" destroy-method="close">
<property name="connectionPoolDataSource" ref="mysqlDataSource"/>
<property name="maxActive" value="20"/>
<property name="maxIdle" value="5"/>
<property name="maxWait" value="-1"/>
</bean>

<service ref="dataSource" interface="javax.sql.DataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="ds-mysql"/>
</service-properties>
</service>
</blueprint>

As I said, I cannot test this myself.

 

Can you give whichever of these suggestions that apply a go, then let me know how you got on?

Anonymous
Not applicable

Hi, 

I try to change my bean in:

<bean id="mysqlDataSource" class="org.mariadb.jdbc.MariaDbDataSource">

to be sure i also run this:

bundle:install mvn:org.mariadb.jdbc/mariadb-java-client/2.5.2

I got always the same result:

Exception in component tDBInput_1 (TestDs)
java.lang.RuntimeException: Driver Class should not be empty, please set it

 

Anonymous
Not applicable

Quick update:

I try to add an oracle DS, installing ojdbc8-12.2.0.1.jar and configuring a 

   <bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">

(I used a sample xml from ..tesb\add-ons\datasources\dataservice)

i change my test job to connect to an oracle db, i check if the datasource is visible and it's fine, but i got the same error:

0683p000009M8ZA.jpg

 

Anonymous
Not applicable

Other update, i create and build a test job in TOS 5.6.3, deployed on the same server, it works!

I believe that's a bug of 7.1.1 that completely ignores "specify ds alias" flag.

The question now is : can i "override" the flag by setting it by code?

Anonymous
Not applicable

Sorry about the delay in getting back to you. I've been quite busy today, but I have been investigating this when I have had the chance. I cannot reproduce this error in v7.1 or v7.2. I have set up an ESB Runtime for both v7.1 and v7.2 and have written services (tRestRequest--->tFlowToIterate--->tDBInput--->tXMLMap---->tRestResponse) in both environments. My DB was a v8 MySQL. While I did get other issues (authentication issues usually associated with MySQL and using the root user), I could not recreate yours. In fact I was able to get the services running pretty quickly once I'd figured out my root user issue.

 

As such I do not believe this to be a bug. What it *could* be is an issue with the service when it was built or (more likely) an issue with the tDBInput component. There are occasions when components have issues like this and all it usually takes is a component replacement with in the job/service.

 

I am using a Mac and believe I have given you all other info other than the version of Java I am using. This is v1.8.0_191-b12.

 

Sorry I haven't been able to help so far, but maybe one of my suggestions in this post might help?

Anonymous
Not applicable

Thanks for your support,

these are my environment specs:

Talend 7.1.1 -> JOB DOESN'T USE DATASOURCE (Java : zulu8.0.232)
(java.lang.RuntimeException: Driver Class should not be empty, please set it)

Talend 5.6.3 -> JOB USES DATASOURCE (Java : 1.7.0_79)

OS : Windows 7 

When i build my RestService i only rightclick the job -> Build Job -> OSGI Bundle For ESB

I tried to recreate new test services taking a new tDBInput from palette... with no success.
I think i'm throwing in the towel.

 

Anonymous
Not applicable

Interesting. The only difference between our setups looks like Zulu...ignoring the operating systems. I guess that *could* be the reason I cannot reproduce this. I would recommend trying v7.2 or maybe waiting for 7.3. I know there are still a few bugs in the v7.3 M3 version which is out for public testing.

 

This is really frustrating as if I could reproduce it I could either help you figure it out from my end or raise it as a bug if there was no way around. But since I cannot even reproduce it, I can't do either. However, if you are willing to go through the steps, you can raise this as a potential bug here https://jira.talendforge.org/