图片存取的问题

守破之间 2002-05-28 04:32:48
各位大虾:
本人将一图片文件放入一字节数组里,现在想将此字节数组中的二进制数据存入数据库里,有什么办法吗?
...全文
16 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
KingSunSha 2002-05-28
  • 打赏
  • 举报
回复
在表中建立一个BLOB字段(Binary Large Object Block),用来存储二进制信息。请参见:
http://www.csdn.net/expert/topic/580/580137.xml?temp=.9592554
http://www.csdn.net/Expert/TopicView.asp?id=83096&datebasetype=200101
penghwa 2002-05-28
  • 打赏
  • 举报
回复
oracle.sql.BLOB
Method Description
byte[] getBytes(long, int)
Gets the contents of the LOB as an array of bytes, given an offset

long position(byte[],long)
Finds the given byte array within the LOB, given an offset

long position(Blob,long)
Finds the given BLOB within the LOB

public boolean equals(java.lang.Object)
Compares this LOB with another . Compares the LOB locators.

public long length()
Returns the length of the LOB

public int getChunkSize()
Returns the ChunkSize of the LOB

public java.io.InputStream getBinaryStream())
Streams the LOB as a binary stream

public java.io.OutputStream getBinaryOutputStream()
Writes to LOB as a binary stream



blob_obj.putBytes(long , byte[]);
long -- position, byte[] -- buffer
lws0472 2002-05-28
  • 打赏
  • 举报
回复
你只能在数据库中定义blob型变量才可以将图片存入数据库,oracle中为long raw型,其他类型不可以存储图片
守破之间 2002-05-28
  • 打赏
  • 举报
回复
思想好像不错,能具体说一下吗?
首先二进制数据导入为一个流,我理解是把字节数组导入到一个long或string型的变量里去,在数据库里加载流干脆就不会操作。麻烦您在给讲一下。
bluecetacean 2002-05-28
  • 打赏
  • 举报
回复
使用流的方法,将字节数组中的二进制数据导入一个流中,在数据库中从该流中加载数据,可实现将该图片存到数据库中

2,596

社区成员

发帖
与我相关
我的任务
社区描述
Sybase相关技术讨论区
社区管理员
  • Sybase社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧