如何使用Java将文件保存到数据库 [英] How can I save a file to database using java
本文介绍了如何使用Java将文件保存到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个可以上传文件(.txt,.doc,.pdf等)的系统...
I want to create a system that can upload file(.txt, .doc, .pdf and so on)...
推荐答案
您有两个选择
1-将它们另存为blob/图像/无论您选择的DB调用什么字节流
2-存储文件的路径,并将文件存储在文件系统中
选项2可以比装满doc,pdf等文件的数据库的开销快很多.
You have two options
1 - save them as a blob/image/whatever your chosen DB calls a stream of bytes
2 - store the paths to the files ,and store the files in your file system
Option 2 can be a lot faster b/c of the overhead of a DB full of doc, pdf, etc files.
You can refer to http://cit3.cdn.swin.edu.au/utilities/upload/File_Upload_Using_Java.html
It may help you.
这篇关于如何使用Java将文件保存到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文