problem with dbi oracle blob

--_009_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_
Content-Type: multipart/alternative;
boundary="_000_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAM AIL10mirab_"

--_000_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi List,

I'm struggeling with the following:

There is a blob field in the oracle db which contains xml...
I want to read this blob and make a single xml file out of it...
Now when using the code below I get the data out of the blob with parts of =
xml but its all messed up...

=C2=AC=C3=AD^ [at] ^Esr^ [at] ^Porg.jdom.Element=C2=B0^]<84>=C3^Q=C3^D:^C^ [at] ^CL^ [at]
attributest^ [at] ^XLorg/jdom/AttributeList;L^ [at] ^Gcontentt^ [at] ^VLorg /jdom/ContentLi=
st;L^ [at] ^Dnamet^ [at] ^RLjava/lang/String;xr^ [at] ^Porg.jdom.ContentB=C 3=A1<91>=C3bS<9=
9>G^B^ [at] ^AL^ [at] ^Fparentt^ [at] ^QLorg/jdom/Parent;xppsr^ [at] ^Vorg.jdom. AttributeList =
^YZ=C2=A8t=C3=A9=C3^ [at] ^CI^ [at] ^Dsize[^ [at] ^KelementDatat^ [at] ^U[Lorg/j dom/Attri=
bute;L^ [at] ^Fparentt^ [at] ^RLorg/jdom/Element;xp^ [at] ^ [at] ^ [at] ^ [at] pq^ [at] ~^ [at] ^Fsr ^ [at] ^Torg.jdom.Co=
ntentList^ [at] ^ [at] ^ [at] ^ [at] ^ [at] ^ [at] ^ [at] ^=C2=B24^B^ [at] ^ [at] xp^ [at] ^ [at] ^ [at] ^Hsq^ [at] ~^ [at] ^ [at] q^ [at] ~ ^ [at] ^Fsq^ [at] ~^ [at] ^G^ [at] =
^ [at] ^ [at] ^ [at] pq^ [at] ~^ [at] ^Psq^ [at] ~^ [at] ^K^ [at] ^ [at] ^ [at] ^Guq^ [at] ~^ [at] ^^ [at] ^S[Lorg.jdom.Conte nt;]=C3+m=C2=AD=
=C3
N^ [at] ^ [at] ^ [at] ^Hsq^ [at] ~^ [at] ^ [at] q^ [at] ~^ [at] ^Psq^ [at] ~^ [at] ^G^ [at] ^ [at] ^ [at] ^ [at] pq^ [at] ~^ [at] ^Tsq^ [at] ~^ [at] ^ K^ [at] ^ [at] ^ [at] ^Auq^ [at] ~^=
[at] ^N^ [at] ^ [at] ^ [at] ^Esr^ [at] ^Morg.jdom.Text^O=C3=B6=C3hw"m<89^B^ [at] ^AL^ [at] ^Evalueq^ [at] ~^ [at] ^Cxq^=
[at] ~^ [at] ^Dq^ [at] ~^ [at] ^Tt^ [at] ^QmkjjKL565udFGJERdppppq^ [at] ~^ [at] ^Tt^ [at] ^Ksecurit yKeyt^ [at] ^ [at] t^ [at] 3ht=
tp://www.mondial-assistance.com/ecommerce/schema/w^A^ [at] xsq^ [at] ~ ^ [at] ^ [at] q^ [at] ~^ [at] ^Psq^=
[at] ~^ [at] ^G^ [at] ^ [at] ^ [at] ^ [at] pq^ [at] ~^ [at] ^^sq^ [at] ~^ [at] ^K^ [at] ^ [at] ^ [at] ^Auq^ [at] ~^ [at] ^N^ [at] ^ [at] ^ [at] ^Esq^ [at] ~^ [at] ^Xq^ [at] ~^ [at] ^^t=
^ [at] ^CTSVppppq^ [at] ~^ [at] ^^t^ [at] ^KpartnerNameq^ [at] ~^ [at] ^\q^ [at] ~^ [at]

Etc etc.... Code below...

#!/usr/bin/perl
use warnings;
use strict;
use DBI;

my $db =3D DBI->connect("dbi:Oracle:host=3D????;sid=3D???", "???", "???", {=
RaiseError =3D> 1}) or die "$DBI::errstr";

open XML, ">./xmlfile"
or die "Can't create xml file ($!)";

# Set Max BLOB size
$db->{LongReadLen} =3D 150000;

# Select statement
my $SEL =3D "select xml_message from table where bla =3D 'bla'";

# Prepare select
my $sth =3D $db->prepare($SEL);

# Execute select
$sth->execute();
my [at] row =3D $sth->fetchrow_array();

print XML "$row[0]\n";

# Disconnect from DB when finished
$db->disconnect if defined($db);



Any help is appreciated!

[cid:blank29.gif]
Marco van Kammen
Applicatiebeheerder
[cid:blank4823.gif]


[cid:blank6784.gif]
Mirabeau | Managed Services Dr. C.J.K. van Aalstweg 8F 301, 1625 NV Hoor=
n
+31(0)20-5950550 - www.mirabeau.nl<http://www.mirabeau.nl>
[Mirabeau]

[cid:leaf3d6c.gif] Please consider the environment before printing thi=
s email




--_000_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
[at] font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
..MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
[at] page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hi List,<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">I’m struggeling with the following:<o:p></o:p>=
</p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">There is a blob field in the oracle db which contain=
s  xml…<o:p></o:p></p>
<p class=3D"MsoNormal">I want to read this blob and make a single xml file =
out of it…
<o:p></o:p></p>
<p class=3D"MsoNormal">Now when using the code below I get the data out of =
the blob with parts of xml but its all messed up…<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">=C2=AC=C3=AD^ [at] ^Esr^ [at] ^Porg.jdom.Element=C2=B0^]<84=
>=C3^Q=C3^D:^C^ [at] ^CL^ [at] <o:p></o:p></p>
<p class=3D"MsoNormal">attributest^ [at] ^XLorg/jdom/AttributeList;L^ [at] ^Gcontentt=
^ [at] ^VLorg/jdom/ContentList;L^ [at] ^Dnamet^ [at] ^RLjava/lang/String;xr ^ [at] ^Porg.jdom.Co=
ntentB=C3=A1<91>=C3bS<99>G^B^ [at] ^AL^ [at] ^Fparentt^ [at] ^QLorg/jdom/Paren=
t;xppsr^ [at] ^Vorg.jdom.AttributeList       =
^YZ=C2=A8t=C3=A9=C3^ [at] ^CI^ [at] ^Dsize[^ [at] ^KelementDatat^ [at] ^U[Lorg/j dom/Attribute;=
L^ [at] ^Fparentt^ [at] ^RLorg/jdom/Element;xp^ [at] ^ [at] ^ [at] ^ [at] pq^ [at] ~^ [at] ^Fsr^ [at] ^To rg.jdom.Content=
List^ [at] ^ [at] ^ [at] ^ [at] ^ [at] ^ [at] ^ [at] ^=C2=B24^B^ [at] ^ [at] xp^ [at] ^ [at] ^ [at] ^Hsq^ [at] ~^ [at] ^ [at] q^ [at] ~^ [at] ^Fs q^ [at] ~^ [at] ^G^ [at] ^ [at] ^ [at] ^=
[at] pq^ [at] ~^ [at] ^Psq^ [at] ~^ [at] ^K^ [at] ^ [at] ^ [at] ^Guq^ [at] ~^ [at] ^^ [at] ^S[Lorg.jdom.Content;]= C3 +m=C2=AD=
=C3<o:p></o:p></p>
<p class=3D"MsoNormal">N^ [at] ^ [at] ^ [at] ^Hsq^ [at] ~^ [at] ^ [at] q^ [at] ~^ [at] ^Psq^ [at] ~^ [at] ^G^ [at] ^ [at] ^ [at] ^ [at] pq^ [at] ~^ [at] ^T=
sq^ [at] ~^ [at] ^K^ [at] ^ [at] ^ [at] ^Auq^ [at] ~^ [at] ^N^ [at] ^ [at] ^ [at] ^Esr^ [at] ^Morg.jdom.Text^O=C3=B 6=C3hw "m&l=
t;89^B^ [at] ^AL^ [at] ^Evalueq^ [at] ~^ [at] ^Cxq^ [at] ~^ [at] ^Dq^ [at] ~^ [at] ^Tt^ [at] ^QmkjjKL565u dFGJERdppppq^ [at] ~=
^ [at] ^Tt^ [at] ^KsecurityKeyt^ [at] ^ [at] t^ [at] 3http://www.mondial-assistance.c om/ecommerce/sc=
hema/w^A^ [at] xsq^ [at] ~^ [at] ^ [at] q^ [at] ~^ [at] ^Psq^ [at] ~^ [at] ^G^ [at] ^ [at] ^ [at] ^ [at] pq^ [at] ~^ [at] ^^sq^ [at] ~^ [at] ^K^ [at] ^ [at] ^ [at] ^Auq^ [at] =
~^ [at] ^N^ [at] ^ [at] ^ [at] ^Esq^ [at] ~^ [at] ^Xq^ [at] ~^ [at] ^^t^ [at] ^CTSVppppq^ [at] ~^ [at] ^^t^ [at] ^Kpartn erNameq^ [at] ~^ [at] ^\q=
^ [at] ~^ [at] <o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">Etc etc…. Code below… <o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">#!/usr/bin/perl <o:p></o:p></p>
<p class=3D"MsoNormal">use warnings; <o:p></o:p></p>
<p class=3D"MsoNormal">use strict;<o:p></o:p></p>
<p class=3D"MsoNormal">use DBI;<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">my $db =3D DBI->connect("dbi:Oracle:host=3D?=
???;sid=3D???", "???", "???", {RaiseError =3D> =
1}) or die "$DBI::errstr";<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">open XML, ">./xmlfile"<o:p></o:p></p>
<p class=3D"MsoNormal">  or die "Can't create xml file ($!)"=
;<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"># Set Max BLOB size<o:p></o:p></p>
<p class=3D"MsoNormal">$db->{LongReadLen} =3D 150000;<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"># Select statement<o:p></o:p></p>
<p class=3D"MsoNormal">my $SEL =3D "select xml_message from table wher=
e bla =3D 'bla'";<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"># Prepare select<o:p></o:p></p>
<p class=3D"MsoNormal">my $sth =3D $db->prepare($SEL);<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"># Execute select<o:p></o:p></p>
<p class=3D"MsoNormal">$sth->execute();<o:p></o:p></p>
<p class=3D"MsoNormal">my [at] row =3D $sth->fetchrow_array();<o:p></o:p></p=
>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">print XML "$row[0]\n";<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"># Disconnect from DB when finished<o:p></o:p></p>
<p class=3D"MsoNormal">$db->disconnect if defined($db);<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">Any help is appreciated! <o:p></o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
</div>
<div style=3D"CLEAR: both">
<table style=3D"CLEAR: both" border=3D"0" cellspacing=3D"0" cellpadding=3D"=
0" width=3D"100%">
<tbody>
<tr>
<td>
<table border=3D"0" cellspacing=3D"0" cellpadding=3D"0" width=3D"645" bgcol=
or=3D"#ffffff" align=3D"left">
<tbody>
<tr>
<td height=3D"16"><img alt=3D"" src=3D"cid:blank29.gif" width=3D"16" height=
=3D"16"></td>
</tr>
<tr>
<td style=3D"LINE-HEIGHT: 140%; FONT-FAMILY: Arial,Helvetica,sans-serif; CO=
LOR: #666; FONT-SIZE: 12px">
<strong>Marco van Kammen</strong></td>
</tr>
<tr>
<td style=3D"LINE-HEIGHT: 140%; FONT-FAMILY: Arial,Helvetica,sans-serif; CO=
LOR: #666; FONT-SIZE: 12px">
Applicatiebeheerder</td>
</tr>
<tr>
<td height=3D"8"><img alt=3D"" src=3D"cid:blank4823.gif" width=3D"8" height=
=3D"8"></td>
</tr>
<tr>
<td>
<table border=3D"0" cellspacing=3D"0" cellpadding=3D"0" width=3D"100%" bgco=
lor=3D"#cccccc">
<tbody>
<tr height=3D"1" bgcolor=3D"#cccccc">
<td bgcolor=3D"#cccccc" height=3D"1"><img alt=3D"" src=3D"cid:blank18be.gif=
" width=3D"1" height=3D"1"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height=3D"8"><img alt=3D"" src=3D"cid:blank6784.gif" width=3D"8" height=
=3D"8"></td>
</tr>
<tr>
<td>
<table border=3D"0" cellspacing=3D"0" cellpadding=3D"0" width=3D"100%">
<tbody>
<tr>
<td valign=3D"top">
<table border=3D"0" cellspacing=3D"0" cellpadding=3D"0" width=3D"100%">
<tbody>
<tr>
<td style=3D"LINE-HEIGHT: 140%; FONT-FAMILY: Arial,Helvetica,sans-serif; CO=
LOR: #666; FONT-SIZE: 12px">
<font color=3D"#666666"><strong>Mirabeau | Managed Services</strong> &=
nbsp;  Dr. C.J.K. van Aalstweg 8F 301, 1625 NV Hoorn<br>
+31(0)20-5950550  -  <a style=3D"COLOR: #666; TEXT-=
DECORATION: none" href=3D"http://www.mirabeau.nl">www.mirabeau.nl</a>
</font></td>
</tr>
</tbody>
</table>
</td>
<td valign=3D"top" width=3D"161"><img alt=3D"Mirabeau" vspace=3D"3" src=3D"=
cid:miralogo4ae1.png">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table border=3D"0" cellspacing=3D"0" cellpadding=3D"0" width=3D"100%">
<tbody>
<tr height=3D"24">
<td height=3D"24" width=3D"20"><img alt=3D"" src=3D"cid:leaf3d6c.gif" width=
=3D"16" height=3D"16">
</td>
<td style=3D"FONT-FAMILY: Arial,Helvetica,sans-serif; COLOR: #91ac1f; FONT-=
SIZE: 12px">
<font color=3D"#91ac1f">Please consider the environment before printing thi=
s email</font></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</body>
</html>

--_000_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_--

--_009_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_
Content-Type: image/gif; name="blank29.gif"
Content-Description: blank29.gif
Content-Disposition: inline; filename="blank29.gif"; size=43;
creation-date="Wed, 25 May 2011 11:45:15 GMT";
modification-date="Wed, 25 May 2011 11:45:15 GMT"
Content-ID: <blank29.gif>
Content-Transfer-Encoding: base64

R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==

--_009_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_
Content-Type: image/gif; name="blank4823.gif"
Content-Description: blank4823.gif
Content-Disposition: inline; filename="blank4823.gif"; size=43;
creation-date="Wed, 25 May 2011 11:45:15 GMT";
modification-date="Wed, 25 May 2011 11:45:15 GMT"
Content-ID: <blank4823.gif>
Content-Transfer-Encoding: base64

R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==

--_009_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_
Content-Type: image/gif; name="blank18be.gif"
Content-Description: blank18be.gif
Content-Disposition: inline; filename="blank18be.gif"; size=43;
creation-date="Wed, 25 May 2011 11:45:15 GMT";
modification-date="Wed, 25 May 2011 11:45:15 GMT"
Content-ID: <blank18be.gif>
Content-Transfer-Encoding: base64

R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==

--_009_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_
Content-Type: image/gif; name="blank6784.gif"
Content-Description: blank6784.gif
Content-Disposition: inline; filename="blank6784.gif"; size=43;
creation-date="Wed, 25 May 2011 11:45:15 GMT";
modification-date="Wed, 25 May 2011 11:45:15 GMT"
Content-ID: <blank6784.gif>
Content-Transfer-Encoding: base64

R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==

--_009_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_
Content-Type: image/png; name="miralogo4ae1.png"
Content-Description: miralogo4ae1.png
Content-Disposition: inline; filename="miralogo4ae1.png"; size=1445;
creation-date="Wed, 25 May 2011 11:45:15 GMT";
modification-date="Wed, 25 May 2011 11:45:15 GMT"
Content-ID: <miralogo4ae1.png>
Content-Transfer-Encoding: base64

iVBORw0KGgoAAAANSUhEUgAAAKEAAAAYCAIAAAAd9gpcAAAAAXNSR0IArs4c 6QAAAARnQU1BAACx
jwv8YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAF KklEQVRoQ+2aPWsV
URCG70/wJ9jbWFpaWQvpJaUWgmIZEAsLbbQQsVO0UkFSJIUWMaCgREEDKnKb pEgEA4GghBRp9MWB
4c07s2d37+5Kig2L3N2d8zXPfJ2zTv6Mf8dJA8+W7vc+nUnvPY4ddtFAc8Y7 uz++Tj/wtX/wOx16
ZNyFSP9tmzMG3bmLp/jCk5zxl+mNeEXRvV+fo9jO7qpJbmw94rf2cP9gM+3c HqLJ4eFeQUnSFvKp
sAzNraYbdzEHboUJF6Zkr6SJNY8Nm4iVR0+X04Xx5tb3nPHT5Um8QFSk19bn oxg0YmKv35/lt66X
tHN/+OLViSpy2z8XpS2EU5uQoeOIn75d8bVgwuUp4a0bLmsgjsLdVvUvXcno HRkjMosfVzlMAhjr
jAuAintnbB0CZ5zc24/n43CpQdQy5uXMxhjuGCcDhcRpS/+DMsbozPjC1TPt GC+tnOQG0atsza38
+OWb0+CBf0VfeCiTg7+m3oa2cRnMGHrHLS6xSOchDGxKcsUYBotP5xNtbjjG iMOg+PD5LZRaroRL
C+cc8/U78/4cwvceL0DeqrDcj7EkXmoaqNsydqNGz8wgMkYedZ3C2li/MQsy Y+4qTR9lBlV+wHNg
G0WwkSbDMQZdx3n7wWUrr8BVGK++W+SHuFXGvBgO145E/KOVH3PgqgJjKuNp gDerNSaRqq7E+azn
GRhzDMPyJaSJzQ3H+NrNOcm+cGL2YwjwrQnDGpQx68UDI69KHHo2xoDNtoI+ 2Rvg5eK4PKuYBZkx
5ozOrQZOQ4UwgAGZvF/lYtMcl3t2DTSxoZlrLsRnAdz8VhmL9s1ImatYcSvG lvxiphRX4OHMzoS6
1Gi1NRdGdHK1NZckDqkMLAFzPSiFy0B+vLzypDlUkVxbXzmSj8GYFwAzZ7M1 H2Ina8U4li0YK+ZX
NgKbgLiOZMEyY4uuHifaMgZUnrZt3uQh56CBGMOPkVlRRsVoXMUeoRspHK3Q VhnzAuBGEqj7ZQwn
kC2vqM8tQHIEW0atHwOSp4O2jNMKS5ybc81AjDmXoVSGayLRpnTBNZ52KWNZ AGvQHGJmP4YuoAKp
k2X7kW6LC/tyzCetuRCcpSsL163yseSIwuGJW+p/YIxVwDWxL0oZ8w7KLUMZ S77hMylrMzNji2lQ
B0dj3vKmRw2pZjkLVtXVYqyWVlrV1VXb4sLhjMShcunA3um/a88y4cexxmbe COnSc8JYJmpL8ojU
kTGGF9154K0NpDy0Z8EqxhCIU23FOD3aKx/OyKBcwUlUSM9zoJwy4xQwoIpP C+aEcepPbpLdGctq
fcvLYRy/wYMvScluc8zYW+GtELL5C2NLH3KZ9cgOIkrKgZ2X7jIuUga6QvEo SUo2XQ39OHqw4Yy1
mJ1+2F/CGE9lAbwr7c4Y/QvOfznmiNt5Rc1hR9RnWbBJzeXFXZNQYdrndJ5+ DpFo55bKh3RVKbzq
+0rZj+Hi4q9+Whm/M0LSP0PljGWiXDr2wljCNZxA3DT9xCQyVq/VMgbg5vtj O6AtVM5ucyLDblBO
5Lxfjym5EKsRqKWcxr7Ze+AjTLDnVxM+kXddIFzzczmG9FdeFWNVLG8Do7e0 8/gKJgW/ceH0s535
OndoYjI0C8AmpG7HbfwIIU8gg+hatXymIkOzlvA75gtERzOgiNaf1NZcCMJW VEsJ7WdhiOfyIXn8
fyAFhffzCrZe5srD1DKGMBBGkBbnsT+Okx4Z9wOyr16aMG471si4rcaGlR8Z D6vf49A773n6ms9f
BCAcUKoFpmwAAAAASUVORK5CYII=

--_009_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_
Content-Type: image/gif; name="leaf3d6c.gif"
Content-Description: leaf3d6c.gif
Content-Disposition: inline; filename="leaf3d6c.gif"; size=665;
creation-date="Wed, 25 May 2011 11:45:15 GMT";
modification-date="Wed, 25 May 2011 11:45:15 GMT"
Content-ID: <leaf3d6c.gif>
Content-Transfer-Encoding: base64

R0lGODlhEAAQAIZ/AKbEVp2sdPf39u7v7LvSerHLbLnRfJ64W8rRtZ/CRYal MvPz7avGYanGWq/K
apWrWP7+/n6dL5u9Qp29TZm6P+7x597e3pO2NrTMcbXNda7JZqzIYqO6Zpm7 O7/Th4KfMqvIYHqX
LaDEQ4ysNeDg4Ofp4LPNc6PDSvP18L7KnqbBX/r89puuadLgq5i8OsTYkY2u MtjktcPWjoOkMcXN
sKTCU4miSaGycvDw8JW0RJy+QY2lTvf68bbQc77ShNvd1sTXko6vNPT185uo eK29grjPec3Tu3eT
Laqvmtva2qmwk77IoarKV63Ccr3Ufu704Ja3O6Wuj4ScRZ2/P4OkL+fn58zW sKSygourM5e4QYmp
NrzSf/z9+rfBnIKhMIeoMr3Qi4SiMbHOZZa5NsXLuaXDVNvnu73Ug5CxN9Tl p5OwRI+yNZa2QZ/A
SKO3aqzKXZ2/RJCrSoylSqfFWaW1eqrHXfj59La/nIKeN7bPd8XZi+fv06LC T9zf0////////yH/
C05FVFNDQVBFMi4wAwEBAAAh+QQBAAB/ACwAAAAAEAAQAAAI4wD9CBxIsOCf ggW5rOBBw8jBgnb2
mInRAkwTFW4eCizRhcWEBhsKGHiRhsPDBXcevCGw5YwHGS886DHpB0WACWI0 aDBhIo8BHwacHDiI
IAeTGmUAzGGQoYgBEz2GCrghAk6bNh3KOMCQwQGIDQ7+VNgxZcwFGFnqbAAB ogEAPkDE2nCx5gOb
BDooSNB7Qs0TsXI6RPgCRUuECF4UXMBjxc+fBQ9GKFYQ4kiID1ikIBB4cAgV EWhmhBkRJE6AEgP/
9LmyJAWRG3SiIPlhUAkZgUIGDICA0HESCyR+kyBRBYcAgwEBADs=

--_009_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mir ab_--
Marco van Kammen [ Mi, 25 Mai 2011 13:45 ] [ ID #2060051 ]

Re: problem with dbi oracle blob

On Wed, May 25, 2011 at 11:45:13 +0000 , Marco van Kammen wrote:
> Hi List,
>
> I'm struggeling with the following:
>
> There is a blob field in the oracle db which contains xml...
> I want to read this blob and make a single xml file out of it...
> Now when using the code below I get the data out of the blob with parts of xml but its all messed up...
> [nasty encoded data snipped]

Are you certain the column isn't encoded somehow, say with a compression
algorithm or something of that sort? What do Oracle's docs say on the
matter?

> #!/usr/bin/perl
> use warnings;
> use strict;
> use DBI;
>
> my $db = DBI->connect("dbi:Oracle:host=????;sid=???", "???", "???", {RaiseError => 1}) or die "$DBI::errstr";
>
> open XML, ">./xmlfile"
> or die "Can't create xml file ($!)";
>
> # Set Max BLOB size
> $db->{LongReadLen} = 150000;
>
> # Select statement
> my $SEL = "select xml_message from table where bla = 'bla'";
>
> # Prepare select
> my $sth = $db->prepare($SEL);
>
> # Execute select
> $sth->execute();
> my [at] row = $sth->fetchrow_array();
>
> print XML "$row[0]\n";
>
> # Disconnect from DB when finished
> $db->disconnect if defined($db);

Your DBI code looks reasonable. I would suggest using the three-argument
form of open with a lexical filehandle, though, like so:

open my $xml, '>', './xmlfile' or die ...

This way is safer and more robust, plus $xml is easier to deal with than
the global XML (try passing XML to a function: it's not immediately
obvious how). I can't see this as related to your issue, but it's good
form nonetheless.

--
Chris Nehren | Coder, Sysadmin, Masochist
Shadowcat Systems Ltd. | http://shadowcat.co.uk/

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Chris Nehren [ Di, 31 Mai 2011 11:27 ] [ ID #2060312 ]
Perl » gmane.comp.lang.perl.beginners » problem with dbi oracle blob

Vorheriges Thema: [META] Why I Often Refer People to http://perl-begin.org/ .
Nächstes Thema: CGI.pm and scrolling list box code error