ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <Nathan.Ma...@Sun.COM>
Subject Re: BLOB/LONGBLOB w/ MySQL & Connector/J
Date Sun, 09 Jan 2005 21:29:20 GMT
Are you using a result map?  If so send it out.  If you are not then 
you need to specify the type inline.

Nathan


On Jan 9, 2005, at 12:27 PM, Brice Ruth wrote:

> I'm using the latest Connector/J driver (3.1.6) for MySQL 3.23.58
> (don't ask - inherited database). Anyway, I've never much used BLOB
> fields, but I need to pull some data out of this database.
>
> I went and grabbed 2.0.9 and saw that it had built-in support for
> BLOB/CLOB as long as your driver (and database?) were well-behaved.
>
> Of course, the docs haven't quite caught up with the release, so I'm
> not sure what qualifies as a well-behaved driver.
>
> I did try a simple test to see if I could just get lucky ... ;)
>
> My JavaBean simply defines three fields as byte[]. The select in my
> SqlMap looks like this:
>
> 	<select id="getImages" resultClass="Image">
> 		SELECT
> 			ean,
> 			picorg AS original,
> 			picthumb AS thumb,
> 			picscale AS scale
> 		FROM
> 			bb_data a
> 		LEFT OUTER JOIN
> 			bb_pic b
> 		ON
> 			a.id=b.id
> 		ORDER BY
> 			ean
> 		LIMIT 1
> 	</select>
>
> Where "Image" is an alias defined in my config. No errors are thrown
> by iBATIS - but when I try to do something like getThumb().length - I
> get an NPE. The fields picthumb and picscale are BLOBs, picorg is a
> LONGBLOB. The other field, ean, is just a string - which is pulled out
> correctly.
>
> Any guidance? Been a long time iBATIS user, just not with BLOB fields 
> :)
>
> Thanks!
>
> Brice


Mime
View raw message