Thread: store pdf files
Hi to all... I need to create a db that contain link to some pdf files.. At the moment these are simple links (to the files that are stored into the file system) storing paths into a column of a dbf table... I need to manage this data considering that the db I'm going to create will be moved in some months to another server... so I think that the link to the files positions into the file system isn't a valid solution... can you suggest me a better way to manage this pdf data?? Each pdf is quite small (<100k) should I use BLOB? many thanks Ivan -- Ti prego di cercare di non inviarmi files .dwg, .doc, .xls, .ppt. Preferisco formati liberi. Please try to avoid to send me .dwg, .doc, .xls, .ppt files. I prefer free formats. http://it.wikipedia.org/wiki/Formato_aperto http://en.wikipedia.org/wiki/Open_format Ivan Marchesini Department of Civil and Environmental Engineering University of Perugia Via G. Duranti 93/a 06125 Perugia (Italy) Socio fondatore GFOSS "Geospatial Free and Open Source Software" http://www.gfoss.it e-mail: marchesini@unipg.it ivan.marchesini@gmail.com tel: +39(0)755853760 fax (university): +39(0)755853756 fax (home): +39(0)5782830887 jabber: geoivan73@jabber.org
ivan marchesini wrote: > Hi to all... > I need to create a db that contain link to some pdf files.. > At the moment these are simple links (to the files that are stored into > the file system) storing paths into a column of a dbf table... > > I need to manage this data considering that the db I'm going to create > will be moved in some months to another server... > so I think that the link to the files positions into the file system > isn't a valid solution... > > can you suggest me a better way to manage this pdf data?? > Each pdf is quite small (<100k) > > should I use BLOB? Leave the files on filesystem and code the highest level directory into a function.
ivan marchesini wrote on 09.12.2008 11:11: > Hi to all... > I need to create a db that contain link to some pdf files.. > At the moment these are simple links (to the files that are stored into > the file system) storing paths into a column of a dbf table... > > I need to manage this data considering that the db I'm going to create > will be moved in some months to another server... > so I think that the link to the files positions into the file system > isn't a valid solution... > > can you suggest me a better way to manage this pdf data?? > Each pdf is quite small (<100k) > > should I use BLOB? I have made quite good experience storing BLOBs (bytea in Postgres) inside the database. I do like the transactional safety I get from the database and the fact that the database an handle several ten thousands of documents in a single table without a problem. With a file based solution you'll need to find a way to distribute the PDFs over different directories to ensure that the file count in each directory doesn't get too high (at least we had some problems storing about 50.000 documents (Word, pdf, ...) on a HP/UX machine in a single directory. Especially when trying to access that directory via ftp... Thomas
On Tuesday 09 December 2008 18:57:15 Frank Bax wrote: > ivan marchesini wrote: > > Hi to all... > > I need to create a db that contain link to some pdf files.. > > At the moment these are simple links (to the files that are stored into > > the file system) storing paths into a column of a dbf table... > > > > I need to manage this data considering that the db I'm going to create > > will be moved in some months to another server... > > so I think that the link to the files positions into the file system > > isn't a valid solution... > > > > can you suggest me a better way to manage this pdf data?? > > Each pdf is quite small (<100k) > > > > should I use BLOB? > > > Leave the files on filesystem and code the highest level directory into > a function. Absolutely not. You'll loose transactional safety the DB provides. That reason alone is good enough to justify storing thefiles in a BLOB (BYTEA in PG). The length(BYTEA)-function in PG can be used to retrieve its length. It is IMMUTABLE and "constant time", which means youcan apply a functional-index on it. That way you don't need to store the size of the file in a separate column. -- Andreas Joseph Krogh <andreak@officenet.no> Senior Software Developer / CEO ------------------------+---------------------------------------------+ OfficeNet AS | The most difficult thing in the world is to | Karenslyst Allé 11 | know how to do a thing and to watch | PO. Box 529 Skøyen | somebody else doing it wrong, without | 0214 Oslo | comment. | NORWAY | | Tlf: +47 24 15 38 90 | | Fax: +47 24 15 38 91 | | Mobile: +47 909 56 963 | | ------------------------+---------------------------------------------+