Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

JDBC Connection DataSource in a Servlet

Avatar

Avatar
Affirm 3
Level 2
crich2784
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

2 solutions
Top badges earned
Affirm 3
Boost 3
Give Back
Validate 1
Boost 1
View profile

Avatar
Affirm 3
Level 2
crich2784
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

2 solutions
Top badges earned
Affirm 3
Boost 3
Give Back
Validate 1
Boost 1
View profile
crich2784
Level 2

23-05-2021

 

I have tried dependency injection but, it cannot find my "Apache Sling Connection Pooled DataSource"

@reference
private DataSourcePool dsp;

 

DataSource ds = (DataSource) dsp.getDataSource("MYDB");

 

I am using SlingSafeMethodsServlet.

 

Any help would be appreciated.

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Affirm 3
Level 2
crich2784
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

2 solutions
Top badges earned
Affirm 3
Boost 3
Give Back
Validate 1
Boost 1
View profile

Avatar
Affirm 3
Level 2
crich2784
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

2 solutions
Top badges earned
Affirm 3
Boost 3
Give Back
Validate 1
Boost 1
View profile
crich2784
Level 2

23-05-2021

Figured it out.

 

@reference(target = "(&(objectclass=javax.sql.DataSource)(datasource.name=MYDB))")
private DataSource ds;

Answers (0)