cx_oracle requires that you call cursor.setinputsizes() for binary
values. If you use the SQLAlchemy expression language or text()
construct with a bind(), this is done automatically.
On Jan 19, 2009, at 2:48 PM, Gregg Parks wrote:
>
> I'm trying to load jpg images in an Oracle Long Raw field using the
> following code:
>
> engine = create_engine('oracle://sysadm:c00l...@testhr:1530/hrupg')
> conn = engine.raw_connection()
> cursor1 = conn.cursor()
>
> f = os.path.join(i.root, i.filename)
> file_size = os.path.getsize(f)
> ifile = open(f, "rb")
> img = ifile.read(file_size)
> ifile.close()
> cursor2.execute(idw_u_sql, emplid=i.emplid, image=img,
> date_acquired=datetime.today().date())
> conn.commit()
>
> Here is the update sql statement:
>
> idw_u_sql = """
> UPDATE PS_IH_IDWORKS
> SET EMPLOYEE_PHOTO = :image,
> DATE_ACQUIRED = :date_acquired
> WHERE EMPL_RCD = 0
> AND EMPLID = :emplid"""
>
> when running this I get the following error message:
>
> ORA-01461: can bind a LONG value only for insert into a LONG column
>
> Any help would be very much appreciated!
>
> Gregg.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---