tMSSQLOutput using a datasource alias isn't working when deployed

One Star

tMSSQLOutput using a datasource alias isn't working when deployed

Hello,
I set up a pooled MS SQL Server datasource in the runtime following this tutorial : https://help.talend.com/search/all?query=Using+datasources+and+connection+pooling+in+Talend+Runtime&...
When I list the datasource in Karaf using "service:list Datasource", there are two datasources :

----------------------
 osgi.service.blueprint.compname = dataSource
 org.talend.esb.datasource.name = ds-derby
 osgi.jndi.service.name = jdbc/sam
 service.id = 359
 service.bundleid = 379
 service.scope = bundle
Provided by :
 Talend ESB :: SAM :: Datasource :: Derby (379)
Used by:
 Talend ESB :: SAM :: Server (425)
 Talend ESB :: SAM :: REST Service (427)
 Talend ESB :: SAM :: SOAP Service (428)

----------------------
 osgi.service.blueprint.compname = dataSource
 org.talend.esb.datasource.name = ds-sqlserver
 osgi.jndi.service.name = jdbc/sam
 service.id = 454
 service.bundleid = 556
 service.scope = bundle
Provided by :
 Talend ESB :: SAM :: Datasource :: SQLServer (556)
As you can notice, the two datasources have the same value for the property "osgi.jndi.service.name".
I created a route calling a job through a cTalendJob component. The job transform the message and store data in a SQL Server database. In the tMSSQLOutput, I set the datasource alias to "ds-sqlserver".
When I try to publish and deploy the route in the runtime, the job isn't working.
I had a look to the job's blueprint.xml file and I found that :
<property name="dataSources">
    <map>
        <entry key="ds-sqlserver">
            <reference interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=ds-sqlserver)" />
        </entry>
    </map>
</property>
This can't work as there are two services with the same JNDI service name (jdbc/sam) and none with "ds-sqlserver". If I change the filter to "(org.talend.esb.datasource.name=ds-sqlserver)", it works.
How can I configure this filter in Talend Studio? Or can I change the JNDI Service Name of the bundle "Talend ESB :: SAM :: Datasource :: SQLServer" through Karaf?
I don't want to change the blueprint.xml of my job every time I deploy the route.
Thank you.
Moderator

Re: tMSSQLOutput using a datasource alias isn't working when deployed

Hi,
Could you please indicate what's the build version you are using? 6.2.1?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: tMSSQLOutput using a datasource alias isn't working when deployed

Hi Sabrina,
I'm using Talend ESB 6.2.1 Enterprise Edition.
Best regards,
Loïc
One Star

Re: tMSSQLOutput using a datasource alias isn't working when deployed

I found a workaround but it's clearly ugly. If I configure the datasource alias with the value "jdbc/sam)(org.talend.esb.datasource.name=ds-sqlserver", it works
In the blueprint\job.xml, the datasource appears like this :
<entry key="jdbc/sam)(org.talend.esb.datasource.name=ds-sqlserver">
                    <reference interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=jdbc/sam)(org.talend.esb.datasource.name=ds-sqlserver)" />
</entry>
IMHO, it's a workaround and not a real solution. There is an existing JIRA asking for a property "osgi.jndi.service.name" configurable outside the bundle : https://jira.talendforge.org/browse/TESB-7671
Do you know if you can resolve this JIRA in a future release?
Thank you.
Moderator

Re: tMSSQLOutput using a datasource alias isn't working when deployed

Hi,
I'm using Talend ESB 6.2.1 Enterprise Edition.

Have you already reported a ticket on talend support portal? Our colleagues from support team will check your issue to see if it is possible to give you a patch on it.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.