views:

55

answers:

4

hello,

I am developing a J2EE application that manages hundreds of jars (saved and loaded on the fly) to manage them i have two options:

  1. create a directory on the server that contains all the jars
  2. save the jar as a LOB in an oracle 10g database

Could you help me to choose the best solution?What are the benefits of each option?

thanks for your help.

+1  A: 

If there are many jars you may use Maven like file organization divided by folders. It's always better to store files in a file system optimized for huge files I/O and keeping their paths/URLs in your database of choice.

Boris Pavlović
I will also support saving files on File System and saving their path/URLs in database. The main advantage that you can get from saving files on File System is that clustering, replication etc. are very cheap and easy to do on a File System as compared to databases + you can also take the advantage of CDN (content distribution networks) for high speed distribution of these files if required.
Faisal Feroz
file systems are for files, databases are for records, +1 for storing the files in the OS file system and putting the references in the database. You can also consider a solution like Amazon S3 if you need to access the files from multiple machines.
Spike Gronim
A: 

A couple of questions first:

  1. What is the average size of the jar file?

  2. How often do you create/modify/use them?

  3. How do you access them?

Daniel Voina
4. Are you expecting that there could be cluster of application servers instead of just one?
Thilo
1-I think that the average size of file will not exceed 50kb2-The jars i dont create them and they are not modified but they are loaded from a GUI and saved for future use...To use that jar I think I will generate ant files and include jars in classpath.
I'm not sure how many the jars will be used because it depends on users, in fact that jars contains tests classes that will be launched by users but I think the number of use will not exceed tens of times per day.I dont expect to use cluster of application server
In this case if the server can serve them directly seem a lot easier.Keeping them as LOBs is cleaner in case of a cluster as @Thilo mentioned. LOBs have also the advantage of being easier to search and maintain - but in your case it is negligible.
Daniel Voina
A: 

What is the security surrounding these files ?

Objects in a database may be easier to secure, and audit access to.

Also, have a look at SecureFiles / DBFS and deduplication Basically, if you store a lot of copies of the same file, the database will realize that and only have one physical copy. The equivalent of symbolic links.

Write performance for SecureFiles is better than a regular filesystem

With DBFS you can also mount the database as a filesystem. That can make it very easy to switch between a 'regular' filesystem storage and database storage.

Gary
Unfortunately this solution is a feature in oracle 11g and i have oracle 10g
A: 

involving a database LOB is going to be a lot slower under almost all circumstances, even if the DB is clustered. Developing a directory and file naming convention isn't going to be that difficult. If you want, you can use the DB to help keep track of the files so you don't have to search the filesystem itself.

John