For one of our apps, I'm using django-pyodbc to connect to an MS SQL 2005 database (not my choice...) This database contains, among other things, rows for the Person model. I've written a function to connect to "Lenel", an access-card system used by our campus security department, which pulls the photos (stored as blobs in their MS SQL 2008 database).
Both the Person model queries, and the Lenel-photo-pulling function work great... by themselves. But when they're put together, they don't work. Basically, if I've loaded *anything* from myapp.models, the get_photo_from_lenel function fails. >From what I can tell, Django (or django-pyodbc) isn't cleaning up its connection to MSSQL DB #1, and when I use pyodbc to connect to MSSQL DB #2, it seems to be routing it somewhere else. But that's just a guess? I read that the connection persists as long as the object exists, so I tried "del me" and "del Person", but the error message still shows up, unless I restart my python shell. This is my function: http://dpaste.com/hold/263816/ And this is what happens when I use it: >>> from naz.directories.getphotos import get_photo_from_lenel >>> nazid = u'1237946' >>> tuple(get_photo_from_lenel(naz_id=nazid)) (14439, '1234567', <read-only buffer for 0x18482b0, size 11387, offset 0 at 0x1a04fb0>) >>> from naz.directories.getphotos import get_photo_from_lenel >>> from naz.directories.models import Person >>> me = Person.objects.get(nazid=1234567) >>> nazid = me.nazid >>> nazid = u'1234567' >>> get_photo_from_lenel(naz_id=nazid) >>> tuple(get_photo_from_lenel(naz_id=nazid)) Traceback (most recent call last): File "<console>", line 1, in <module> File "/var/django/naz/../naz/directories/getphotos.py", line 112, in get_photo_from_lenel cursor.execute(query) Error: ('IM001', '[IM001] [unixODBC][Driver Manager]Driver does not support this function (0) (SQLColAttribute)') -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.