problem with dbi oracle blob
am 25.05.2011 13:45:13 von Marco van Kammen --_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...
¬Ã^@^Esr^@^Porg.jdom.Element°^]<84>=C3^Q=C3^D:^C^@^CL^@
attributest^@^XLorg/jdom/AttributeList;L^@^Gcontentt^@^VLorg /jdom/ContentLi=
st;L^@^Dnamet^@^RLjava/lang/String;xr^@^Porg.jdom.ContentB=C 3=A1<91>=C3bS<9=
9>G^B^@^AL^@^Fparentt^@^QLorg/jdom/Parent;xppsr^@^Vorg.jdom. AttributeList =
^YZ¨té=C3^@^CI^@^Dsize[^@^KelementDatat^@^U[Lorg/j dom/Attri=
bute;L^@^Fparentt^@^RLorg/jdom/Element;xp^@^@^@^@pq^@~^@^Fsr ^@^Torg.jdom.Co=
ntentList^@^@^@^@^@^@^@^²4^B^@^@xp^@^@^@^Hsq^@~^@^@q^@~ ^@^Fsq^@~^@^G^@=
^@^@^@pq^@~^@^Psq^@~^@^K^@^@^@^Guq^@~^@^^@^S[Lorg.jdom.Conte nt;]=C3+mÂ=
=C3
N^@^@^@^Hsq^@~^@^@q^@~^@^Psq^@~^@^G^@^@^@^@pq^@~^@^Tsq^@~^@^ K^@^@^@^Auq^@~^=
@^N^@^@^@^Esr^@^Morg.jdom.Text^Oö=C3hw"m<89^B^@^AL^@^Evalueq^@~^@^Cxq^=
@~^@^Dq^@~^@^Tt^@^QmkjjKL565udFGJERdppppq^@~^@^Tt^@^Ksecurit yKeyt^@^@t^@3ht=
tp://www.mondial-assistance.com/ecommerce/schema/w^A^@xsq^@~ ^@^@q^@~^@^Psq^=
@~^@^G^@^@^@^@pq^@~^@^^sq^@~^@^K^@^@^@^Auq^@~^@^N^@^@^@^Esq^ @~^@^Xq^@~^@^^t=
^@^CTSVppppq^@~^@^^t^@^KpartnerNameq^@~^@^\q^@~^@
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 @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
[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
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
1">
Hi List,
I’m struggeling with the following:
There is a blob field in the oracle db which contain=
s 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…
¬Ã^@^Esr^@^Porg.jdom.Element°^]<84=
>=C3^Q=C3^D:^C^@^CL^@
attributest^@^XLorg/jdom/AttributeList;L^@^Gcontentt=
^@^VLorg/jdom/ContentList;L^@^Dnamet^@^RLjava/lang/String;xr ^@^Porg.jdom.Co=
ntentBá<91>=C3bS<99>G^B^@^AL^@^Fparentt^@^QLorg/jdom/Paren=
t;xppsr^@^Vorg.jdom.AttributeList =
^YZ¨té=C3^@^CI^@^Dsize[^@^KelementDatat^@^U[Lorg/j dom/Attribute;=
L^@^Fparentt^@^RLorg/jdom/Element;xp^@^@^@^@pq^@~^@^Fsr^@^To rg.jdom.Content=
List^@^@^@^@^@^@^@^²4^B^@^@xp^@^@^@^Hsq^@~^@^@q^@~^@^Fs q^@~^@^G^@^@^@^=
@pq^@~^@^Psq^@~^@^K^@^@^@^Guq^@~^@^^@^S[Lorg.jdom.Content;]= C3 +mÂ=
=C3
N^@^@^@^Hsq^@~^@^@q^@~^@^Psq^@~^@^G^@^@^@^@pq^@~^@^T=
sq^@~^@^K^@^@^@^Auq^@~^@^N^@^@^@^Esr^@^Morg.jdom.Text^O=C3=B 6=C3hw "m&l=
t;89^B^@^AL^@^Evalueq^@~^@^Cxq^@~^@^Dq^@~^@^Tt^@^QmkjjKL565u dFGJERdppppq^@~=
^@^Tt^@^KsecurityKeyt^@^@t^@3http://www.mondial-assistance.c om/ecommerce/sc=
hema/w^A^@xsq^@~^@^@q^@~^@^Psq^@~^@^G^@^@^@^@pq^@~^@^^sq^@~^ @^K^@^@^@^Auq^@=
~^@^N^@^@^@^Esq^@~^@^Xq^@~^@^^t^@^CTSVppppq^@~^@^^t^@^Kpartn erNameq^@~^@^\q=
^@~^@
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 wher=
e bla =3D 'bla'";
# Prepare select
my $sth =3D $db->prepare($SEL);
# Execute select
$sth->execute();
my @row =3D $sth->fetchrow_array();
print XML "$row[0]\n";
# Disconnect from DB when finished
$db->disconnect if defined($db);
Any help is appreciated!
Marco van Kammen
Applicatiebeheerder
=3D"16" height=3D"16"> | SIZE: 12px"> |
--_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:
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:
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:
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:
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:
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
G0Wwk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CMJW 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:
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_--