ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brice Ruth <bdr...@gmail.com>
Subject BLOB/LONGBLOB w/ MySQL & Connector/J
Date Sun, 09 Jan 2005 19:27:20 GMT
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