Oliver
Oliver

Reputation: 6250

How to use DataSourcePool in Adobe CQ5.5?

I have created a @Component and in that component at instance level I am doing @Reference DataSourcePool.

But the Class DataSourcePool is not found so my class doen't compile. I am using CRXDE Eclipse. I have done all this by following this link.

http://helpx.adobe.com/experience-manager/using/datasourcepool.html

Please See my code and snap shot.

package com.videojet.hiresite.database;

import java.sql.Connection;
import java.sql.DriverManager;
import com.day.commons.datasource.poolservice.DataSourcePool;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;

@Component
@Service
public class ConnectionProvider {

    @Reference
    private DataSourcePool source;

    public Connection getConnection() throws Exception
    {
        //VideojetDatasource
        Class.forName("oracle.jdbc.driver.OracleDriver");   
        return DriverManager.getConnection("jdbc:oracle:thin:@xxxxxx","xxxx","xxx");

    }

}

enter image description here

So Do I have to Add an Extra Jar in OSGi Bundle to this to work ?

Update @ Tomek Rękawek Dude When I say I'm not using Maven I mean it. I have NOT followed the whole tutorial. This is what I am using it's CRXDE Eclipse enter image description here

Upvotes: 0

Views: 1454

Answers (2)

Oliver
Oliver

Reputation: 6250

I solved it. I download the Jar from here http://repo.adobe.com/nexus/content/groups/public/com/day/commons/day.commons.datasource.poolservice/1.0.10/

And I pasted it in /apps/myproject/src/testbundle/libs folder and the dependency is resolved.

Upvotes: 0

Tomek Rękawek
Tomek Rękawek

Reputation: 9304

Add following dependency to your pom.xml:

<dependency>
    <groupId>com.day.commons</groupId>
    <artifactId>day.commons.datasource.poolservice</artifactId>
    <version>1.0.10</version>
    <scope>provided</scope>
</dependency>

In general, if you wonder which bundle contains a class, open the Felix Console, choose Main / Packages (relative path: /system/console/depfinder) and enter the full class name (like com.day.commons.datasource.poolservice.DataSourcePool). You'll get a <dependency> that you can copy & paste to your pom.xml.

Upvotes: 3

Related Questions