从本地向数据库插入BLOB文件 [英] insert BLOB file from Local to DB

查看:334
本文介绍了从本地向数据库插入BLOB文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图允许用户从本地硬盘中选择一个文件,并使用java将其作为BLOB值插入Oracle数据库中.

I am trying to allow users to choose a file from local hard disk and to insert it with java in a Oracle Data base as BLOB value.

setBinaryStream不允许大文件.

The setBinaryStream did not allow big files.

使用setBlob,我无法将文件转换为blob.

with the setBlob I have no way to convert the file to a blob.

是否是从数据库导入blob文件然后覆盖它的唯一解决方案?

Is the import of a blob file from the DB then overwrite it the unique solution?.

关于, Haythem

Regards, Haythem

推荐答案

这是我以前使用过的建议

实质上,文件字节数组,您可以做的是读取文件数据并使用PreparedStatement.setBytes(index, byte[])存储数据.

In essence a file is an array of bytes, what you can do is to read the file data and use PreparedStatement.setBytes(index, byte[]) to store the data.

希望这会有所帮助.

这篇关于从本地向数据库插入BLOB文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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