Thread: [cx-oracle-users] blob insert
Brought to you by:
atuining
From: d' A. <gn...@gm...> - 2009-07-07 22:00:29
|
i was trying to insert a binary file (an image) into a table in an oracle database, everything goes well inserting another values, but when i try to insert a blob i get an error that the operation must be into a transaction. I ask to Google but i didn't find any interesting result. Can someone help me. An inserting blob program will be usefull, thanks. -- Paz, Amor Y Empatia ----------------------- Ariel Hernandez Amador Gnu/LiNUX user: #354782 |
From: Jared G. <jar...@or...> - 2009-07-08 04:29:19
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I believe you need to use the Cursor.setinputsizes method to setup the sql properly before the call. For example, I have a script that uses CLOB type (similar to BLOB) and the first thing I do before actually executing the SQL is the following... self.cursor.setinputsizes(description=cx_Oracle.CLOB) Where self.cursor is my Cursor object and description is the name of the bindvar used in the SQL code that I'm executing. - -Jared On 07/07/2009 06:00 PM, d' Ariel wrote: > i was trying to insert a binary file (an image) into a table in an > oracle database, everything goes well inserting another values, but > when i try to insert a blob i get an error that the operation must be > into a transaction. > > I ask to Google but i didn't find any interesting result. Can someone > help me. An inserting blob program will be usefull, thanks. > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkpUF/UACgkQu4z7XptgTUZh3QCfZmsHwSez9uPgdOgBJcdvwT0N dWwAnjUH7TjtDogncAKKDyCkW2+fjYNS =FX7U -----END PGP SIGNATURE----- |
From: d' A. <gn...@gm...> - 2009-07-08 16:30:38
|
Let see, i don't understand you. I'm executing a simple code: import cx_Oracle conection = cx_Oracle.connect('user/pass@<server:port>/session') cursor = connection.cursor() cursor.execute("select data from <sometable> where id = <some existing id>") clob, = cursor.fetchone() clob.open() and i get an ORA-22292 error (not able to open an read-write lob whitout a transaction) any idea??? -- Paz, Amor Y Empatia ----------------------- Ariel Hernandez Amador Gnu/LiNUX user: #354782 |
From: Jared G. <jar...@or...> - 2009-07-08 16:46:28
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Oh, ok, I thought you said you were having issues with insert. I think instead of clob.open() you should use clob.read() something like... clob_data = clob.read() (I thought you were referencing blob data.) Anyway, I'm certainly no expert on cx_Oracle (or python), but have been using these particular pieces of code (insert/read) for over a year now and it seems to work. - -Jared On 07/08/2009 12:30 PM, d' Ariel wrote: > Let see, i don't understand you. > > I'm executing a simple code: > > import cx_Oracle > > conection = cx_Oracle.connect('user/pass@<server:port>/session') > cursor = connection.cursor() > cursor.execute("select data from <sometable> where id = <some existing id>") > clob, = cursor.fetchone() > clob.open() > > and i get an ORA-22292 error (not able to open an read-write lob > whitout a transaction) > any idea??? > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkpUzWEACgkQu4z7XptgTUZhVQCcCL2eOykqGIBP2rx9g2HSj5C3 XYQAn230i0VNBHE1lJPgb9wjXP7fNPCk =PaPe -----END PGP SIGNATURE----- |
From: Amaury F. d'A. <ama...@gm...> - 2009-07-08 16:46:22
|
Hello, 2009/7/8 d' Ariel <gn...@gm...>: > Let see, i don't understand you. > > I'm executing a simple code: > > import cx_Oracle > > conection = cx_Oracle.connect('user/pass@<server:port>/session') > cursor = connection.cursor() > cursor.execute("select data from <sometable> where id = <some existing id>") > clob, = cursor.fetchone() > clob.open() > > and i get an ORA-22292 error (not able to open an read-write lob > whitout a transaction) > any idea??? I suggest to remove the call to clob.open(), and call clob.read() directly. -- Amaury Forgeot d'Arc |
From: d' A. <gn...@gm...> - 2009-07-08 17:18:32
|
solved thanks. 2009/7/8 Amaury Forgeot d'Arc <ama...@gm...>: > Hello, > > 2009/7/8 d' Ariel <gn...@gm...>: >> Let see, i don't understand you. >> >> I'm executing a simple code: >> >> import cx_Oracle >> >> conection = cx_Oracle.connect('user/pass@<server:port>/session') >> cursor = connection.cursor() >> cursor.execute("select data from <sometable> where id = <some existing id>") >> clob, = cursor.fetchone() >> clob.open() >> >> and i get an ORA-22292 error (not able to open an read-write lob >> whitout a transaction) >> any idea??? > > I suggest to remove the call to clob.open(), and call > clob.read() > directly. > > -- > Amaury Forgeot d'Arc > > ------------------------------------------------------------------------------ > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited time, > vendors submitting new applications to BlackBerry App World(TM) will have > the opportunity to enter the BlackBerry Developer Challenge. See full prize > details at: http://p.sf.net/sfu/Challenge > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > -- Paz, Amor Y Empatia ----------------------- Ariel Hernandez Amador Gnu/LiNUX user: #354782 |