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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Data source service deploy on runtime

Hello.

I've created datasource.xml file to store many connections and use "specify a data source alias" in studio.

datasource.xml file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0">


    <bean id="ds1" class="com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource">
	<property name="URL" value="..." />
        <property name="user" value="..." />
	<property name="password" value="..." />
    </bean>

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

    <service ref="dspool1" interface="javax.sql.DataSource">
        <service-properties>
            <entry key="org.talend.esb.datasource.name" value="name1" />
            <entry key="osgi.jndi.service.name" value="jdbc/name1" />
        </service-properties>
    </service>
.....another service
.....
</blueprint>

And everything works fine when I deploy datasource.xml by placing it in container/deploy.
But I want to start this service on startup runtime.
So I'm creating featureRepository and I don't know how to define this service.
I was able to add and auto start other bundles I needed in this way:

<feature name="dataSourceFeature" version="1.0">
  <bundle>wrap:mvn:commons-dbcp/commons-dbcp/1.4</bundle>
  <bundle>wrap:mvn:com.microsoft.sqlserver/sqljdbc4/4.0</bundle>
</feature>

and then add dataSourceFeature to featuresBoot.

I don't know how to start datasource.xml manually.

When I run on Karaf console bundle:install and put mvn url I've got 
Error executing command: Error installing bundles:
Unable to install bundle mvn:com......./datasource/0.3/xml: org.osgi.framework.BundleException: Error occurred installing a bundle.

Labels (1)
  • v7.x

10 Replies
Anonymous
Not applicable
Author

You are right.
That's my first thought.
I just wonder what is best practise to use DB connection in studio and cloud.
I see in cloud there is an option to define connection