Re: How to keep photos into the database ?

From: Pedro Pimentel <ppf_at_uninova.pt>
Date: 7 Mar 1995 02:23:28 GMT
Message-ID: <3jgg30$183_at_asterix.uninova.pt>


In article <D51AtH.Ent_at_dcc.uchile.cl>, crpalma_at_cec.uchile.cl (CRISTIAN PALMA) says:
>
>
>Hi ...
>
>I have the next problem: I want to keep photographys into my database
>and I don't know how does it ... :-) ( the photographys that I want to keep
>are of 20 Kb only ... )
>
>First: the field in the table that cointain the photography, of what type
>have to be ? Raw, long raw ?
>
> create tables photos ( photo raw );
> or
> create tables photos ( photo long raw );

  Something like this is the best way (at least thats what I used :) ):

		CREATE TABLE BLOBS (code     number(5) PRIMARY KEY,
				    size     number(8),
				    long_raw LONG RAW) ;
		CREATE TABLE photos (code    number(5) PRIMARY KEY,
				     c_blob  number(5) REFERENCES BLOBS,
				     c_small_blob number(5) REFERENCES BLOBS,
				     author  char,
                                     file_name char,
                                     date_taken date,
                                     .....
				     .....
					) ;

   This way you have only a table for all the BLOBs (binary large objects). You can put on it not only the photos but any kind of file. You need only to create another table referencing the blobs to store the blob information.

  This way is better too because of the queries: if you would have all the information in one table, the queries will be much slower because of the long raw field. This way you query on the photos table and only if you need, get the long raw field.

  Any comments on this design ?

>
>Second: how to up the photography to the database ? Trough sqlloader, for
>instance ? And how to do this trough this ? Or trough another tool ?

  You can't use SQL*Loader and SQL*Plus. You can do it with Pro*C. It's necessary a previous knowledge of C. You can also do it through ODBC in Windows (also programming in C or Visual Basic).

>Well, this is my little doubt :-) ... thanks in advance

--
Pedro Pimentel
ppf_at_uninova.pt
http://terra.uninova.pt/pedro/pedro1.html
Received on Tue Mar 07 1995 - 03:23:28 CET

Original text of this message