[DB-SIG] Problems w/BLOBs

George Jones gsjonesjr@yahoo.com
Tue, 17 Dec 2002 15:27:43 -0800 (PST)


Hello,
     I'm trying to store binary data in a BLOB in an
Oracle 9i db(Is that, 9i rather than 8, my problem?). 
I'm new to Python, and very new to DCOracle2, which is
the module I'm using to connect to the db.  I'm able
to load the data into the db, although not in the way
that the documentation suggests, but when I retrieve
it the LobLocator Object's read method wont work.

in_file = open('boo','rb')
input_string = in_file.read()

import DCOracle2
db = DCOracle2.connect('blah/blah')
c = db.cursor()
c.execute('insert into my_blob values(:1, :2)', 1, \
DCOracle.Binary(input_string, 'SQLT_BLOB')
db.commit()
c.execute('select file_data from my_blob where
file_id\ = 1')
result = c.fetchone()
res_obj = result[0]
print res_obj.length() # this gives right length
138240
out_string = res_obj.read() # this gives nothing

So what am I doing wrong?
TIA
GSJ


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com