New issue 69 by upadh...@gmail.com: JNDI not being recognized
http://code.google.com/p/django-jython/issues/detail?id=69
What steps will reproduce the problem?
1. Basic django-jython(1.3.0b2) with django(1.3.1) setup using tomcat(6.0)
under eclipse(Eclipse Java EE IDE for Web Developers. Version: Helios
Service Release 2).
2. Using 'doj.backends.zxjdbc.mysql', with
mysql-connector-java-5.1.6-bin.jar. It works if I specify database settings
in settings.py, without JNDI.
3. Documentation
says(http://packages.python.org/django-jython/database-backends.html#jndi-support):
When using JNDI and with the exception of DATABASE_BACKEND, all the other
DATABASE_* options will be ignored by django-jython
What is the expected output? What do you see instead?
Expected: Documentation
says(http://packages.python.org/django-jython/database-backends.html#jndi-support):
When using JNDI and with the exception of DATABASE_BACKEND, all the other
DATABASE_* options will be ignored by django-jython
What I see: The setting DATABASE_OPTIONS is being ignored. JNDI_NAME is
correct, as java uses it correctly to connect to database. Further
intentionally misspelling JNDI_NAME gives no errors or warning. It appears
to being completely ignored.
I have tried both:
DATABASE_OPTIONS = {'JNDI_NAME': 'java:comp/env/jdbc/MyProjectDB'}
And:
'OPTIONS': {'JNDI_NAME': 'java:comp/env/jdbc/MyProjectDB'},
inside DATABASES["default"].
Further, the connection successfully establishes based on database settings
in settings.py despite including JNDI_NAME in either way mentioned above.
What version of the product are you using? On what operating system?
Mac OSX Lion
Just noticed this bit: "create a file named pollsite.xml". This is not what
I am doing, in my case, "context.xml" exists under META-INF. Which is where
it should be for my java part of my application.
What is pollsite? The project I suppose. In my case I have only got a
settings.py, and a foo.py, which is a servlet:
from javax.servlet.http import HttpServlet
from com.brunchcase import Query
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "settings"
from django.template.loader import render_to_string
class foo(HttpServlet):
def doGet(self,request,response):
self.doPost (request,response)
def doPost(self,request,response):
toClient = response.getWriter()
response.setContentType ("text/html")
toClient.println("<pre>%s</pre>" %
Query(request, "amitu").execute().toString(4))
toClient.println(render_to_string("foo.html", {"name": "amitu"}))
from django.contrib.auth.models import User
print User.objects.all()
I do not have an actual django project. foo.py and settings.py are in
WebContent, and I have got the following in my web.xml:
<servlet>
<servlet-name>PyServlet</servlet-name>
<servlet-class>org.python.util.PyServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>PyServlet</servlet-name>
<url-pattern>*.py</url-pattern>
</servlet-mapping>
Note: All this works as expected, just that JNDI_NAME is being ignored, and
I guess I am not getting connection pooling advantage without it.
Comment #2 on issue 69 by juneau001: JNDI not being recognized
http://code.google.com/p/django-jython/issues/detail?id=69
(No comment was entered for this change.)
Seems to be a regression issue.
Current trunk fixes this issue for mysql but still exists for oracle
backend.
Thanks for the feedback...will look at repair for Oracle backend.