Python Oracle 10g odbc blob insertion problem

Godzilla godzillaismad at gmail.com
Fri Mar 23 00:20:22 EDT 2007


On Mar 23, 9:50 am, Steve Holden <s... at holdenweb.com> wrote:
> Godzilla wrote:
> > On Mar 23, 4:38 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> >> On 22 Mar 2007 05:36:46 -0700, "Godzilla" <godzillais... at gmail.com>
> >> declaimed the following in comp.lang.python:
>
> >>> Steve, I think I've tried what you have suggested without any luck as
> >>> well... The statement works fine, but what inserted is not correct...
> >>> it seems like only the symbol '?' was inserted into the blob field...
> >>         You didn't have a set of 's around the ?, did you? Parameter
> >> substitution will add needed quotes on its own rather than you having to
> >> put in quotes.
>
> >>         Also, though I find no documentation on it, odbc module cursors have
> >> setinputsizes() and setoutputsizes() methods -- perhaps that could
> >> change things... OTOH: the db-api 1.0 PEP (which is, it seems, what odbc
> >> module follows) says they may be do-nothing methods.
> >> --
> >>         Wulfraed        Dennis Lee Bieber               KD6MOG
> >>         wlfr... at ix.netcom.com             wulfr... at bestiaria.com
> >>                 HTTP://wlfraed.home.netcom.com/
> >>         (Bestiaria Support Staff:               web-a... at bestiaria.com)
> >>                 HTTP://www.bestiaria.com/
>
> > Everything seems to work fine right now... thanks all of you for
> > helping... Have a great day..
>
> Have you any idea what fixed the problem?
>
> regards
>   Steve
> --
> Steve Holden       +44 150 684 7255  +1 800 494 3119
> Holden Web LLC/Ltd          http://www.holdenweb.com
> Skype: holdenweb    http://del.icio.us/steve.holden
> Recent Ramblings      http://holdenweb.blogspot.com- Hide quoted text -
>
> - Show quoted text -

Hi Steve,

I guess Dennis and yourself pointed me to the right direction; no need
the 's around ? and also the parameter substitution requires tuple.
I.e.:

qry.execute("Insert into tBlob (data) values (?)",
(data.encode('hex'),))

Thanks again guys... it's been greatly appreciated by the team here as
well.




More information about the Python-list mailing list