Error in inserting blob into ORACLE using ODBC.Windows

Bjorn Pettersen bjorn at roguewave.com
Fri Dec 31 10:53:11 EST 1999


Don't know too much about mxODBC, but a little bit about Oracle...

>From the first error you describe, it looks like you are trying to insert the
blob into something that is not a long or a long raw column.  My guess is that
you have declared the column as type BLOB, which is an oracle 8 datatype not
supported by odbc to any great extent.

For the second error, you probably want to open your icon file in binary mode,
i.e. f=open(icon_path, 'r+b')  (or is that 'rb', I forget...)

Hope this helps.

-- bjorn

TM wrote:

> I have a problem inserting BLOB into ORACLE using ODBC.Windows with either
> the Oracle ODBC driver or the Micorsoft ODBC driver for Oracle.
>
> After mxODBC 1.1.1 installation, i run the test.py and got some errors:
>
> Test suite:
>  Connecting to the database.
>  Connected to DBMS: Oracle8; Version: 08.00.5000
>               ODBC driver: SQOCI32.DLL 8.0.3.0.0; ODBC Version: 02.50
> ...
>  BLOB column type with binary data           : unexpected database error
> [mxODBC.OperationalError: ('S1000', 1461, 'ORA-01461: can bind a LONG value
> only for insert into a LONG column\012', 3176)]
>
> Then i tried out a few lines to insert a BLOB
>
> import ODBC
> conn = ODBC.Windows.Connect('...',clear_auto_commit=0)
> cur = conn.cursor()
> ...
> f=open(icon_path,'r')
> icon=f.read()
>
> sql='INSERT INTO my_table (seq_no, blob_data) VALUES (36,?)'
> cur.execute(sql,(icon,))
>
> and get this error:
> OperationalError: ('S1000', 1465, 'ORA-01465: invalid hex number\012',
> 3176)
>
> What step did i missed?
>
> I also need some pointer on how to get the BLOB backout.
>
> Tanming Fong
> tmfong at hotmail.com
>
> Thanks in advance for any help.
>
> --
> http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list