Josep Curto wrote:
> Hi,
>
> I use a servlet to UPDATE a BD (mySQL) trough JDBC . All works fine with SQL
> strings like : INSERT INTO table1 (id_pais,link,descripcio) VALUES (1,"a
> link","a description")
> But now, I want to INSERT into the DB a BLOB FIELD with BINARY DATA (really
> is the data of a JPG file).
> I can't make a SQLstring with binary data for the executeQuery(String)
> method of my Statement.
> How can I solve that ?
>
> thanks in advance,
>
In the JDBC spec, check out the use of a PreparedStatement for this. One of
the things you can do is replace a parameter with an input stream that feeds in
to a BLOB (using the setBinaryStream() method, for example), which is designed
to solve exactly the kind of problem you are facing.
Craig McClanahan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html