Article View: borland.public.interbase.sql
Article #11112Re: Java insert InputStream nto BLOB field
From: Martijn Tonies
Date: Fri, 13 Dec 2002 06:55
Date: Fri, 13 Dec 2002 06:55
40 lines
2099 bytes
2099 bytes
Hi,
To insert BLOBs you need to use the PreparedStatement interface -
prepare a statement, then fill the parameters and call Execute.
--
With regards,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase & Firebird
Firebird Workbench - the developer tool for Firebird
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
> I need to introduce an InputStream coming from an attachment of a mail
> message in a type field BLOB, but it is I impossible. Could they help me?
> This code this well?
>
> filename=parte.getFileName();
> streamFichero=parte.getInputStream();
> try
> {
> inserta="INSERT INTO ANEXOS (NUM,ANEXO,NOMBRE) VALUES
> ("+indice_anexo+","+streamFichero+",'"+filename+"')";
>
> insertar.execute(inserta); insertar.execute("COMMIT");
> }
> catch (SQLException c)
> {
> error(c.getMessage());
> }
>
> Thank you
>
>
Technical Details
Message-ID:
<3df983cf@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<atb6h0$1209mv$1@ID-146066.news.dfncis.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,3d95d01d14a0b807 X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-12-12 23:04:36 PST From: "Martijn Tonies" <m.tonies@upscene_remove.com> Newsgroups: borland.public.interbase.sql References: <atb6h0$1209mv$1@ID-146066.news.dfncis.de> Subject: Re: Java insert InputStream nto BLOB field Date: Fri, 13 Dec 2002 07:55:57 +0100 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 212.238.179.102 Message-ID: <3df983cf@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1039762383 212.238.179.102 (12 Dec 2002 22:53:03 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail