Попытка создать тестовое приложение django, которое будет использовать хранимые процедуры оракула для вставки / получения данных.
Использование jython с zxJDBC, но такая же ошибка относится и к python и cx_oracle.
здесьнекоторые фрагменты кода:
models.py
from django.db import models
from django.db import connection
class ALEX_TEST_PKG():
def get_data(self, inparam1):
cursor = connection.cursor()
ret = cursor.callproc("ALEX_TEST_PKG.test0", inparam1)
cursor.close
return ret
views.py
class TestForm(forms.Form):
inparam1 = forms.CharField(max_length=500)
def message(request):
if request.method == 'POST':
form = TestForm(request.POST)
else:
form = TestForm()
if form.is_valid():
my_util = ALEX_TEST_PKG()
ret = my_util.get_data(request.POST['inparam1'])
return HttpResponse(ret)
return render_to_response('form.html', {'form':form}, context_instance=RequestContext(request))
процедуры Oracle:
CREATE OR REPLACE PACKAGE BODY ALEX.alex_test_pkg
IS
PROCEDURE test0 (inparam1 IN integer)
IS
BEGIN
insert into alex_debug(col1) values(inparam1);
END test0;
END alex_test_pkg;
/
Журнал ошибок Django:
Environment:
Request Method: POST
Request URL: http://localhost:8000/form/
Django Version: 1.3.1
Python Version: 2.7.0
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'dbtest']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "C:\Python27\lib\site-packages\django-1.3.1-py2.7.egg\django\core\handlers\base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "E:\WatchTower\workspace3\erwtwe\erwtwe\dbtest\views.py" in message
19. ret = my_util.get_data(request.POST['inparam1'])
File "E:\WatchTower\workspace3\erwtwe\erwtwe\dbtest\models.py" in get_data
7. ret = cursor.callproc("ALEX_TEST_PKG.test0", inparam1)
Exception Type: DatabaseError at /form/
Exception Value: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TEST0'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Любая помощь приветствуется.ломая голову этим уже 3 дня.