My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 13: support JNDI lookups for backends
3 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  crankycoder
Closed:  Dec 21
Type-Enhancement
Priority-Medium
Milestone-Release1.0


Sign in to add a comment
 
Reported by crankycoder, Jul 27, 2009
This is really low hanging fruit.  We should support JNDI lookups when
creating database connections.  When deploying Django apps into a j2ee
container, this will enable administrators to configure connection pooling
parameters.

We can add two extra parameters into settings.py : DATABASE_JNDI_NAME and
DATABASE_JNDI_FALLBACK.

The JNDI name will be used to do the JNDI lookup and the FALLBACK setting
can be set to allow the backend to fallback to regular 'direct' connections
to the databse in the event that JNDI is not available.  This will
facilitate one set of settings for development deployments.  When doing a
production deployment, the FALLBACK setting can be set to False so that
JNDI is always used.
Comment 1 by leo.soto, Jul 27, 2009
I agree we need to support it out of the box. 

My only (really minor) observation would be to define entries in the DATABASE_OPTIONS
dictionary instead of creating new settings entries which is what other third-party
backends do. as far as I've seen.

Labels: Milestone-Release1.0
Comment 2 by crankycoder, Aug 05, 2009
I've got this working for pgsql, just need to push up the code.  I used the
database_options dict as you suggested.
Comment 3 by leo.soto, Aug 05, 2009
Nice. I wonder how can we add testing for this. Or shouldn't it need any special tests?
Comment 4 by leo.soto, Oct 27, 2009
Hey Vic, can you commit the associated code (or post a patch here)?
Comment 5 by johnsonnenschein, Dec 20 (5 days ago)
> Hey Vic, can you commit the associated code (or post a patch here)?

any news on this? I'd like to patch it here to do that.
Comment 6 by crankycoder, Dec 21 (4 days ago)
i branched and updated the base.py in postgresql's backend.

I did *not* put in the fallback code though.  I can't seem to get the failover to 
'regular' connections to work properly and when I finally did kludge a solution - it 
wasn't obvious to me whether I was hitting 'raw' database connections or through the 
JNDI/IIOP connection.  Which is bad.  And not very python-like.

The patch can be applied to the other backends safely - it's pretty small.  The 
tricky part is figuring out what bizarre set of JAR files are required to instantiate 
the InitialContextFactory for your particular JNDI server.
Status: Fixed
Sign in to add a comment

Hosted by Google Code