spotfire:如何使用参数化信息链接将 blob 写入数据库?
spotfire: How to write blob to database with parameterized informaion links?
我正在尝试使用参数化信息 links 将我在 R 中生成的一些图表写回我们的 Oracle 11g 数据库,但我一直遇到同样的错误:
Failed to execute data source query for data source "FITS_GRAPH".
at Spotfire.Dxp.Data.DataSourceConnection.ExecuteQuery2()
at Spotfire.Dxp.Data.OnDemand.InformationLinkFunctionExecutor.SetOutputResult(DataSource dataSource, DataFunctionInvocation invocation, Boolean isEmpty)
at Spotfire.Dxp.Data.OnDemand.InformationLinkFunctionExecutor.<ExecuteFunction>d__0.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__6.MoveNext()
我正在使用 ggplot 在开源 R 中生成图表,并使用以下命令将它们保存为二进制文件:
tmpPlot <- ggplot(x, aes(x = LogConc, y = Normalized))
ggsave(name, plot = tmpPlot, units = 'cm', device = 'png', width = 15, height = 15, dpi = 300)
img=readBin(file(name, open="rb"), what="raw", n=(file.info(name)$size))
图表需要作为 blob 加载到数据库中,因为我们的报告软件希望以这种方式找到它们。
我很高兴地设法将这些图表添加到 return 作为 spotfire 中的一个专栏。但是,如果我尝试使用该列输入信息 link 参数,则会出现上述错误。
我试过使用以下存储过程创建:
CREATE OR REPLACE PROCEDURE fits_graph_insert (
experiment_id IN fits_graph."EXPERIMENT_ID"%TYPE,
sample_id IN fits_graph."SAMPLE_ID"%TYPE,
replicate_id IN fits_graph."REPLICATE_ID"%TYPE,
image IN fits_graph."IMAGE"%TYPE
)
IS
BEGIN
INSERT INTO fits_graph (
"EXPERIMENT_ID",
"SAMPLE_ID",
"REPLICATE_ID",
"IMAGE"
) VALUES (
experiment_id,
sample_id,
replicate_id,
image
);
COMMIT;
END fits_graph_insert;
或在信息link中添加以下内容作为预更新:
INSERT INTO FITS_GRAPH (
"EXPERIMENT_ID",
"SAMPLE_ID",
"REPLICATE_ID",
"IMAGE"
)
VALUES (
?input_exp_id,
?input_sample_id,
?input_rep_id,
?input_image
)
在任何一种情况下,如果我不包含 image/blob,更新运行正常。
有谁知道是否有办法将此数据写回数据库而不会遇到此错误。
我也试过转换为 base64
编码的字符串,但是结果太长,无法写入 VARCHAR2
字段。
如有任何想法或意见,我们将不胜感激。
我的解决方案是将图像编码为 base64 字符串,然后将其上传到 CLOB 字段而不是 VARCHAR2 字段。
我正在尝试使用参数化信息 links 将我在 R 中生成的一些图表写回我们的 Oracle 11g 数据库,但我一直遇到同样的错误:
Failed to execute data source query for data source "FITS_GRAPH".
at Spotfire.Dxp.Data.DataSourceConnection.ExecuteQuery2()
at Spotfire.Dxp.Data.OnDemand.InformationLinkFunctionExecutor.SetOutputResult(DataSource dataSource, DataFunctionInvocation invocation, Boolean isEmpty)
at Spotfire.Dxp.Data.OnDemand.InformationLinkFunctionExecutor.<ExecuteFunction>d__0.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__6.MoveNext()
我正在使用 ggplot 在开源 R 中生成图表,并使用以下命令将它们保存为二进制文件:
tmpPlot <- ggplot(x, aes(x = LogConc, y = Normalized))
ggsave(name, plot = tmpPlot, units = 'cm', device = 'png', width = 15, height = 15, dpi = 300)
img=readBin(file(name, open="rb"), what="raw", n=(file.info(name)$size))
图表需要作为 blob 加载到数据库中,因为我们的报告软件希望以这种方式找到它们。
我很高兴地设法将这些图表添加到 return 作为 spotfire 中的一个专栏。但是,如果我尝试使用该列输入信息 link 参数,则会出现上述错误。
我试过使用以下存储过程创建:
CREATE OR REPLACE PROCEDURE fits_graph_insert (
experiment_id IN fits_graph."EXPERIMENT_ID"%TYPE,
sample_id IN fits_graph."SAMPLE_ID"%TYPE,
replicate_id IN fits_graph."REPLICATE_ID"%TYPE,
image IN fits_graph."IMAGE"%TYPE
)
IS
BEGIN
INSERT INTO fits_graph (
"EXPERIMENT_ID",
"SAMPLE_ID",
"REPLICATE_ID",
"IMAGE"
) VALUES (
experiment_id,
sample_id,
replicate_id,
image
);
COMMIT;
END fits_graph_insert;
或在信息link中添加以下内容作为预更新:
INSERT INTO FITS_GRAPH (
"EXPERIMENT_ID",
"SAMPLE_ID",
"REPLICATE_ID",
"IMAGE"
)
VALUES (
?input_exp_id,
?input_sample_id,
?input_rep_id,
?input_image
)
在任何一种情况下,如果我不包含 image/blob,更新运行正常。
有谁知道是否有办法将此数据写回数据库而不会遇到此错误。
我也试过转换为 base64
编码的字符串,但是结果太长,无法写入 VARCHAR2
字段。
如有任何想法或意见,我们将不胜感激。
我的解决方案是将图像编码为 base64 字符串,然后将其上传到 CLOB 字段而不是 VARCHAR2 字段。