🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.interbase.sql
2 messages
2 total messages Started by Galo Alcolea Thu, 12 Dec 2002 23:33
Java insert InputStream nto BLOB field
#11108
Author: Galo Alcolea
Date: Thu, 12 Dec 2002 23:33
20 lines
1593 bytes
Hello
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
Re: Java insert InputStream nto BLOB field
#11112
Author: Martijn Tonies
Date: Fri, 13 Dec 2002 06:55
40 lines
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
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads