JDBC Connection DataSource in a Servlet | Community
Skip to main content
crich2784
New Participant
May 23, 2021
Solved

JDBC Connection DataSource in a Servlet

  • May 23, 2021
  • 1 reply
  • 764 views

 

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

@3214626
private DataSourcePool dsp;

 

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

 

I am using SlingSafeMethodsServlet.

 

Any help would be appreciated.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by crich2784

Figured it out.

 

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

1 reply

crich2784
crich2784AuthorAccepted solution
New Participant
May 23, 2021

Figured it out.

 

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