小编sco*_*ott的帖子

将 Oracle 中的 BLOB 迁移到 PostgreSQL

我使用BLOBOracle 表中的数据类型来存储图像和文档文件。现在对于 Postgres(9.4.5),我有两个选择,即,BYTEAOID.

考虑到从 Java 端传递参数(SAVING)如下:

DiskFileItemDeepy file  =  myFile;  
InputStream is = null;
long fileSize = 0;
if (file != null && file.getFileSize() > 0){ 
  is = file.getInputStream(); 
  fileSize = file.getFileSize(); 
  call.setBinaryStream(1, (InputStream)is,  (long)fileSize);
}
...
call.execute(); 

//When retrieve the data use:

java.sql.Blob blob = (Blob) resultSet.getBlob(tableColumnName);  
Run Code Online (Sandbox Code Playgroud)

出于上述目的,哪种 Postgres 数据类型更适合替换BLOB,是BYTEA还是OID

postgresql oracle migration blob postgresql-9.4

3
推荐指数
1
解决办法
5536
查看次数

标签 统计

blob ×1

migration ×1

oracle ×1

postgresql ×1

postgresql-9.4 ×1