最好的方法是将BLOB存储在数据库中? [英] Grooviest way to store a BLOB in a database?

查看:137
本文介绍了最好的方法是将BLOB存储在数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编写一个实用程序脚本以将图像插入数据库时​​,我想知道是否有一个groovier做的方式。最后结算的东西沿着这一行:

While writing a utility script to insert images into a database I wondered if there were a groovier way of doing it. In the end settled for something along the lines of this:

def sql = Sql.newInstance(...)
// ...    
Connection conn = sql.getConnection()
PreparedStatement stmt.prepareStatment(...)
stmt.setBinary(...)
stmt.executeUpate()

必须有一个groovier的方式,有人能启发我吗?

There must be a groovier way, can someone enlighten me?

推荐答案

Groovier方式可能只是存储您存储图像的路径。

A "Groovier" way could be just storing the path were you'd store the images.

将图像存储在目录中,并仅将数据库中的路径存储是最好的方法。

Storing the images in a directory and storing just the path in the db is the best way.

这篇关于最好的方法是将BLOB存储在数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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