Support external javax.sql.DataSource sources

Bug #575994 reported by Rob Dawson
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
play framework
Won't Fix
Undecided
Unassigned
1.0
Won't Fix
Undecided
Unassigned
1.1
Fix Committed
Undecided
Unassigned

Bug Description

Update the DBPlugin to support using a datasource specified via JNDI.

Specify a JNDI name using the property:
db.jndi.name.

I'm putting together a patch for this which I will test and attach soon.

Revision history for this message
Guillaume Bort (guillaume-bort) wrote :

You can already do that:

# If you want to reuse an existing Datasource from your application server, use:
# db=java:/comp/env/jdbc/myDatasource

Changed in play:
status: New → Invalid
Revision history for this message
Rob Dawson (robert-rojotek) wrote :

Where is that property used?

I saw it in the application.conf, but it didn't seem to work for me. When I looked at the source, I couldn't find it, and I had to make some changes to get the external datasource stuff working (where the code expected a ComboPooledDataSource).

Revision history for this message
Celso Pinto (cpinto) wrote :

Actually, Rob is right. In DBPlugin.java, at the onApplicationStart method, it's assumed that a database connection is started through db.X properties. In the change() method, it appears that the db property only accounts for the following values:
 - mem
 - fs
 - mysql.*

If db.driver or db.url are null then it's assumed that the configuration didn't change and onApplicationStart() won't actually do anything. In effect, using a database connection pool through JNDI is not supported and I think that Rob should submit a patch and you should consider to merge it quickly.

When you're using the WAR export feature, editing the application.conf just to change the database settings is a major pain in the ass as far as operation teams are concerned.

Changed in play:
status: Invalid → Confirmed
Changed in play:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.