I want to read an Oracle BLOB and display it. I have seen several examples on the internet, but none of them seem to work.

I am on the following platform:

Zope Version (Zope 2.6.1 (source release, python 2.1, linux2), python 2.1.3, linux2) Python Version 2.1.3 (#1, Sep 19 2002, 21:42:04) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-110)] System Platform linux2

I am trying to read a BLOB from an Oracle database. I have noticed that when I test the ZSQL, I get the following error:

The SQL:

select wgtphot_photo as photo from kenglund.wgtphot where wgtphot_pidm = 252853

This seems to be returning the image ok. I had to set the max results to one to get it to work.

The Python:

result = []
lob = ['image']
for row in context.sqllogo:
  lob = row['photo']
#  result.append({'image': lob.read()})
# above was remmed
container.REQUEST.RESPONSE.setHeader('content-type', 'image/jpeg') return lob

The Web page:

<td><img src="logo;" alt="foto"></td>

Can you give me some ideas as to what I am doing wrong, or if it is even possible to do what I am trying? I know we are on an old version of Zope and Python. I inherited this system from someone no longer working here, and upgrading is on my to-do list.

Thanks so very much!

Ken Englund
Sweet Briar College
Sweet Briar, Virginia
United States

Zope-DB mailing list

Reply via email to