如何使用存储过程将图像作为字节插入mysql db中 [英] How to insert images in mysql db as bytes using stored procedure

查看:78
本文介绍了如何使用存储过程将图像作为字节插入mysql db中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...

我正在使用Mysql工作台5.1版本,将图像转换为字节[]并插入到mysql表中。

问题是当我插入将图像转换为数据库,它显示错误,如...

Hi...
I am using Mysql work bench 5.1 version, convert image into bytes[] and insert into mysql table.
The problem is when i insert image into db, it showing error like..

"data too long for column 'IMAGE' at row 1"



这里的图像是列名,其数据类型为longblob(


Here image is column name and its data type is longblob(

in byteimg longblob(65534)

)。 />
请帮帮我,哪种数据类型适合它?

谢谢你。

) in stored procedure.
Please help me, which data type is suitable for it?
Thank u.

推荐答案

当列数据条目超过8,000个字节时,使用varbinary(max)。


这篇关于如何使用存储过程将图像作为字节插入mysql db中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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