Mike RA9FTM
unread,Apr 5, 2009, 12:59:40 PM4/5/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Hi. I need direct connection to oracle for import some information
sometimes.
Here is what I do for first test:
def orcl_test(request):
connstr='scott/tiger@orcl'
conn = cx_Oracle.connect(connstr)
curs = conn.cursor()
curs.execute('select * from dept')
rows = [row[2] for row in curs.fetchall()]
conn.close()
return render_to_response('DekanatImport/test.html', {'rows':
rows})
This django view work, when I first load it in browser. But after
pressing F5 I have following error.
By debugging it using PyDev, I found, that it appears after conn =
cx_Oracle.connect(connstr) string.
I am using Django 1.0, cx_Oracle-5.0.1-10g.win32-py2.6.msi.
raceback (most recent call last):
File "I:\Python26\lib\site-packages\django\core\servers
\basehttp.py", line 277, in run
self.result = application(self.environ, self.start_response)
File "I:\Python26\lib\site-packages\django\core\servers
\basehttp.py", line 634, in __call__
return self.application(environ, start_response)
File "I:\Python26\lib\site-packages\django\core\handlers\wsgi.py",
line 239, in __call__
response = self.get_response(request)
File "I:\Python26\lib\site-packages\django\core\handlers\base.py",
line 128, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)
File "I:\Python26\lib\site-packages\django\core\handlers\base.py",
line 148, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "I:\Python26\lib\site-packages\django\views\debug.py", line 39,
in technical_500_response
html = reporter.get_traceback_html()
File "I:\Python26\lib\site-packages\django\views\debug.py", line 97,
in get_traceback_html
'exception_value': smart_unicode(self.exc_value,
errors='replace'),
File "I:\Python26\lib\site-packages\django\utils\encoding.py", line
35, in smart_unicode
return force_unicode(s, encoding, strings_only, errors)
File "I:\Python26\lib\site-packages\django\utils\encoding.py", line
70, in force_unicode
raise DjangoUnicodeDecodeError(s, *e.args)
DjangoUnicodeDecodeError: 'utf8' codec can't decode bytes in position
11-12: invalid data. You passed in DatabaseError(<cx_Oracle._Error
object at 0x00D48E60>,) (<class 'cx_Oracle.DatabaseError'>)