Saving json data as blob

1,276 views
Skip to first unread message

Marco Maranao

unread,
Oct 17, 2012, 6:45:55 PM10/17/12
to cfwh...@googlegroups.com
Hi guys,

I'm trying to save a json data as a blob but i'm getting an error:
java.lang.String cannot be cast to [B

Here's my code:
datum = model("datum").new();
datum.uid = 123456789;
datum.data = '{"user_id":123456}';
datum.save();

Hope you guys can help.
Thanks!

Chris Peters

unread,
Oct 18, 2012, 9:10:58 AM10/18/12
to cfwh...@googlegroups.com
What happens if you change the field to text or clob? The JSON data isn't technically binary, so I don't see the need for a (B)inary (L)arge (OB)ject.

--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cfwheels/-/1Me1CPxSLUkJ.
To post to this group, send email to cfwh...@googlegroups.com.
To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.

Marco Maranao

unread,
Oct 18, 2012, 9:24:50 AM10/18/12
to cfwh...@googlegroups.com
Doh. Clob worked! Must have been a long day. Thanks Chris!

Chris Peters

unread,
Oct 18, 2012, 9:38:58 AM10/18/12
to cfwh...@googlegroups.com
No prob. I remember a while ago wondering what the heck the difference was between clob and blob. It turns out it's (c)haracter vs. (b)inary.

On Thu, Oct 18, 2012 at 9:24 AM, Marco Maranao <ma...@maranao.ca> wrote:
Doh. Clob worked! Must have been a long day. Thanks Chris!
--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cfwheels/-/vw86qlMMeHEJ.

Marco Maranao

unread,
Oct 18, 2012, 10:25:21 AM10/18/12
to cfwh...@googlegroups.com
Actually MySQL, it's the TEXT datatype.

Thanks again!
Reply all
Reply to author
Forward
0 new messages