关于mysql存取blob图片问题

huanhuan63 2008-10-29 05:26:25
mysql数据库
表名:mat_picture
字段:matno varchar
picture longblob
程序如下:
conn = Database.createOAConnect();
sql = "insert into mat_picture(matno,picture) values(?,?)";
pstm = conn.prepareStatement(sql);
//插入料号
pstm.setString(1, matno);
is = new FileInputStream(new File(filename));
//插入图片
pstm.setBinaryStream(2,is,is.available());
pstm.executeUpdate();
(其中filename为存图片的物理地址)
但是报这个错误,不知道怎么解决:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{?R_???s?O??{?=????z?s?w?~wkf??>??,?g6??÷±n×??ü?·z??N–???c_?(N????ú{}???lt··' at line 1
...全文
197 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sanyechonggyq 2008-11-09
  • 打赏
  • 举报
回复
关注中...
qiying1988 2008-11-09
  • 打赏
  • 举报
回复
up
wsorg 2008-11-08
  • 打赏
  • 举报
回复
郁闷,我也是这样的问题,Delphi用MyDAC连接MySQL,存图片时保存就提示乱码。

#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S蝳绯?D\\茄LA&蚖彎????獃糣S榕mX藟 U愊 諹x詶#u裭to9tHs湒楈X黩囦?g纽' at line 3'. Process TestPIC.exe (680)
First chance exception at $7C812AEB. Exception class EMyError with message '
#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S蝳绯?D\\茄LA&蚖彎????獃糣S榕mX藟 U愊 諹x詶#u裭to9tHs湒楈X黩囦?g纽' at line 3'. Process TestPIC.exe (680)
love_mysql 2008-10-30
  • 打赏
  • 举报
回复
存取路径吧。怎么又有存取文件体的!

56,679

社区成员

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

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