ny3259 发表于 2016-10-24 09:06:07

mysql中使用spring存取大文件blob和clob

查了一些关于clob和blob的区别,大致记得是:clob适宜于存储大文本文件,而blob适宜于存储图片二进制文件,我还为 了记忆,理解为character和binary。

可是,今天动手实验了一下发现,文本文件如果不仅仅是上传存储,还需要下载使用的话,还是使用blob字段存储比较好,因为使用clob存储的话,在上传的时候是按照string操作的,文件内部的格式就变了,比如:没有了原文件的换行。

<property name="content" type="org.springframework.orm.hibernate3.support.BlobByteArrayType" column="content" length="100000"/>

<property name="content" type="org.springframework.orm.hibernate3.support.ClobStringType" column="content" length="100000"/>
页: [1]
查看完整版本: mysql中使用spring存取大文件blob和clob