database - How to store file and reference it to java web application? -


it kind of basic thing store file seems, stumbled upon problem. here understood storing files on server while programming in java.

  1. you can't store in mysql, because if file heavy, not recommended. so, decided not opt this.

  2. it not recommended store files in containers, such tomcat or wildfly, may because of fact needs deployed , that??

  3. you can store file, apache file server? confused in this. can this, , store files in here, reference database? similar way websites store images or files on?

  4. i came across databases such nosql, didn't go depth, thinking might wrong @ end, , have invested time in other stuff.

saying so, way store file in server, reference on java web application, , record in database?

we don't put our files in database (nosql or rdbms) because not file systems. if uploads file, store in file system , record name , other metadata in db future use. can technically put contents of file in database , has own merits , drawbacks - https://softwareengineering.stackexchange.com/a/150787/156860

uploaded files not recommended reside in web/app servers because might have more 1 server handle load , if put file in 1 server, other server might face problems in accessing content. , if 1 server goes down, files in server not available other servers use. you'd need shared drive/disk servers can connect , read file.

javaee handles providing resource adapter abstracts how application interacts 'resources' in general (could file or other resource well). without having more detail on kind of files, how big, , how being used, it'll hard 'the' solution question.


Comments