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

SOLVED

JDBC Connection DataSource in a Servlet

crich2784
Level 4
Level 4

 

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.

 

1 Accepted Solution
crich2784
Correct answer by
Level 4
Level 4

Figured it out.

 

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

View solution in original post

1 Reply
crich2784
Correct answer by
Level 4
Level 4

Figured it out.

 

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

View solution in original post