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

The "Datasource Alias" will work in Talend Runtime. However, it will not work in the Studio, So when you are using this you will need to make sure the alias is set and any Studio test configurations are removed before running it in the Runtime. The "Specify a datasource alias" option is described here for Oracle. It works in the same way for all DBs.

Anonymous
Not applicable

Hi, i also have deployed a trestRequest job, i have subjobs for logging that connect to mysql DB with mariadb-java-client-1.8.0.jar driver.

I'm trying to add connection pooling. I've defined and deployed ds:

 

 

<?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="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<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>

I flag "Specify a data source alias" and named it "ds-mysql"

When I try to call my ws I receive this error:

java.lang.RuntimeException: Child job running failed.
java.lang.RuntimeException: Driver Class should not be empty, please set it

It seems that the flag "Specify a data source alias" is completely ignored.

What i am missing?

Thanks

 

Anonymous
Not applicable

Where are you running your service? In the Studio or in the Runtime?

Anonymous
Not applicable

I deployed the jar in test environment.

btw if i run  "service:list DataSource" it seems to be ok.

[javax.sql.DataSource]
----------------------
service.id = 385
osgi.jndi.service.name = ds-mysql
osgi.service.blueprint.compname = dataSource
service.bundleid = 286
service.scope = bundle
Provided by :
Bundle 286

 

Anonymous
Not applicable

From what you have shown, this should be working. Can you share a screenshot of a service that is not working. Also can you share the DB config for that job?

Anonymous
Not applicable

Hi,

I've posted the xml bean with DB config and the error in the previous message.

below you find the screen of the option i set to use a ds alias in the dbconnection component, i also try the same config in a tdboutput with the connection option "use this component", i also try to remove all context params (JDBC URL, Driver Class, User Id, Password) that i normally use in TOS ide


tDBConn.JPG
Anonymous
Not applicable

Can you show how your service is built? I cannot see any issues so far. I may have to recreate this. So can you tell me what version you are using so that I can recreate this as closely as possible? If you are using a subscription version, it might be better for you to speak to support.

Anonymous
Not applicable

Hi,

thank you for your patience, this is my main job, but i don't think it can help you:

0683p000009M8dS.jpg

here's a subjob that reads from db:
0683p000009M8dX.jpg

 

every log subjob writes some data...

0683p000009M8Tn.jpg

 

I'm using TOS for ESB 7.1.1.20181026_1147

I try to recap what's going on:

the service is working fine if i don't use db-alias flag but use instead a cfg file with db info.
If i try to use datasource alias flag, (I clear all db parameters in components to be sure that the info is taken from xml ds), than i get this error "Driver Class should not be empty, please set it" just as the flag is not set.

Anonymous
Not applicable

Thanks for this. I will try and recreate it. However, in the meantime you might be able to try something. Can you write a quick service to use a DB component without a tRunJob. So just a simple service to return a value from a database with all of the components running in the service and not in a tRunJob. That *could* be it.

 

I'll need to set up a MySQL DB and replicate your type of job. I'll get on to this as soon as I am through a few meetings. I'll probably be able to respond by tomorrow.