encode image for 'setBinaryStream'
From: Georg Andersson (georg.andersson_at_swisstopo.ch)
Date: 07/26/04
- Previous message: Claudio Alberto Andreoni: "Re: What about a new DB without SQL?"
- Next in thread: Gerd Nachtsheim: "Re: encode image for 'setBinaryStream'"
- Reply: Gerd Nachtsheim: "Re: encode image for 'setBinaryStream'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Jul 2004 07:58:34 -0700
hi
i like to store small images in a mssql database. i'm using the code
below for the insert-statement.
PreparedStatement prstmt=connection.prepareStatement("INSERT INTO
GCP_IMAGE VALUES(?,?,?,?,?,?,?,?");
prstmt.setLong(1,11);
prstmt.setShort(2,(short)4);
prstmt.setBinaryStream(3,fis,(int)file.length());
prstmt.setString(4,"11_DRAWING.jpg");
prstmt.setLong(5,file.length());
prstmt.setString(6,"image/pjpeg");
prstmt.setNull(7,Types.INTEGER);
prstmt.setNull(8,Types.INTEGER);
prstmt.execute();
this code returns the foolowing error:java.sql.SQLException:
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1:
Incorrect syntax near '@P8'.
after looking through many forums and web-sites, i figured out that i
would have to encode my image in order to pass the data correctly to
the database.
has anybody got an idea how i'm supposed to do that?
best regards
- Previous message: Claudio Alberto Andreoni: "Re: What about a new DB without SQL?"
- Next in thread: Gerd Nachtsheim: "Re: encode image for 'setBinaryStream'"
- Reply: Gerd Nachtsheim: "Re: encode image for 'setBinaryStream'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|