如何使用 Grails 在数据库中存储文件 [英] How to store a file in the database with Grails

查看:13
本文介绍了如何使用 Grails 在数据库中存储文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用 Grails 在数据库中存储一个文件.那么,你知道我该怎么做吗?我应该在域类中使用哪种数据类型(byte[] 可能是一个解决方案)?

I need to store a file in the database using Grails. So, do you know how I can do that? Which data type should I use in the domain class (byte[] might be a solution)?

推荐答案

请参阅 Grails 用户指南.也可以使用 java.sql.Blob 作为二进制内容的类型(这在处理大文件时更可取).

See Chapter on Uploading Files in the Grails User Guide. It is also possible to use a java.sql.Blob as type for the binary content (which would be preferable when dealing with huge files).

这篇关于如何使用 Grails 在数据库中存储文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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