使用 Worklight 适配器从 derby 检索存储为 CLOB 的 base64 图像 [英] Retrieve base64 image stored as a CLOB from derby with Worklight adapter

查看:26
本文介绍了使用 Worklight 适配器从 derby 检索存储为 CLOB 的 base64 图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 Worklight SQL 适配器检索在 Derby DB 中存储为 CLOB 的图像.我想做一些类似于这里写的东西:https://www.ibm.com/developerworks/community/blogs/dhuyvett/entry/jsonstore_revisited_in_worklight_v6_part_1_the_adapter?lang=en除了引用的文章作者使用的是 DB2.有谁知道我如何在德比做到这一点?目前,当我去检索执行 SQL 选择的图像时,返回的字符串是

I am trying to retrieve an image stored as a CLOB in a Derby DB via a Worklight SQL adapter. I would like to do something similar to what was written up here: https://www.ibm.com/developerworks/community/blogs/dhuyvett/entry/jsonstore_revisited_in_worklight_v6_part_1_the_adapter?lang=en except for the referenced article the author is using DB2. Does anyone know how I can do this in Derby? Currently when I go to retrieve the image doing a SQL Select, the string returned is

图像":org.apache.derby.impl.jdbc.EmbedClob@2d236"

"IMAGE": "org.apache.derby.impl.jdbc.EmbedClob@2d236"

我也会考虑使用 mysql 作为替代方案.感谢您的任何建议.

I would also consider mysql as an alternative. Thanks for any suggestions.

JT

推荐答案

org.apache.derby.impl.jdbc.EmbedClob 是一个 java.sql.Clob,所以如果你在 var 中有 CLOB,你应该可以获取数据:

org.apache.derby.impl.jdbc.EmbedClob is a java.sql.Clob, so if you have the CLOB in a var, you should be able to get the data with:

var dataAsString = theClob.getSubString(1, theClob.length());  // Assumes all CLOBS are < 2G

这篇关于使用 Worklight 适配器从 derby 检索存储为 CLOB 的 base64 图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆