I usually use ps.setBytes() and pass it a byte[] array ..


On Wed, 22 Oct 2003, Scott Purcell wrote:

> Hello,
> I have opted to insert some small jpg files into the mysql database using java.
> Code below.
>
> When I do a select from the table using the mysql> command line, it generates
> pages of
> -------------------------------------------------------------------------------------------------------
> -------------------------------------------------------------------------------------------------------
> which I guess is a visual of the blobed data.
>
> Anyway, I am used to Oracle I guess where it still shows the data, but shows a blob 
> in the column and not all the lines.
>
> Am I doing this wrong, or is this the way it is handled?
>
> Here is my code, the api showed using a prepared statement. It works, but the 
> selecting does not look proper.
>
> Thanks,
> Scott
> ####### code below)
>
> Connection db = null;
>         PreparedStatement stmt = null;
>         ResultSet rs = null;
>
>         try {
>             db = DriverManager.getConnection(
>                                              "jdbc:mysql://127.0.0.1:3306/menagerie",
>                                              "root", "xxxxx");
>
>                      InputStream in = new FileInputStream(f);
>
>             stmt = db.prepareStatement("insert into preview (username, theblob) 
> values (?, ?)");
>             stmt.setString(1, "louie-louis");
>             stmt.setBinaryStream(2, in, (int)f_length);
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to