Require Help regarding Mysql Database (Urgent).

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.
Post Reply

Which database you use under Linux.

Oracle
1
9%
MySQL
9
82%
PostgreSQL
1
9%
DB2
0
No votes
 
Total votes: 11

hassanmuneer
Lance Naik
Posts: 25
Joined: Fri Apr 09, 2004 4:41 pm
Location: Lahore

Require Help regarding Mysql Database (Urgent).

Post by hassanmuneer »

AOA

i use mysql with RH9.and want to save some images in database (gif,jpeg).if anyone know that how to save image file in mysql .Plz Guide me. and i also require help regarding retrive data with the help of c.I know about the c API that is used to retrive data.but i want to discuss some problem with a person that already work on it.

Regards
Ask not what your country can do for you, Ask what you can do for your country
jargon
Lieutenant Colonel
Posts: 691
Joined: Mon Oct 13, 2003 9:40 am

Post by jargon »

You are looking to store binary data, this seems to be a good reference.
http://www.phpbuilder.com/columns/florian19991014.php3
jargon
zaeemarshad
Lieutenant Colonel
Posts: 660
Joined: Sat Jul 06, 2002 12:35 pm
Location: Islamabad
Contact:

Post by zaeemarshad »

I would suggest you store the image on the filesystem as a normal file and store the path info in the database. That wont make ur database grow very large . just my 0.02$

cheers
zaeem
asaf
Lance Naik
Posts: 41
Joined: Wed Aug 07, 2002 8:00 pm
Location: Karachi
Contact:

Storing images in MySQL

Post by asaf »

Zaeem's advice is good. You can place a link to the images in the database. However, if you still would like to place the images in the database, the type to use is blob or binary large object.


my 2 cents.

asaf
Asaf Maruf Ali
PING Systems
Network Security-Linux-Consulting
605, 6th Floor,
Clifton Centre, Block 5,
Clifton, Karachi-75600
Pakistan
Tel # 5872438, 5868275, 5833971-2
Fax # 5868927
saquib_javed
Naib Subedar
Posts: 344
Joined: Sat Apr 10, 2004 9:07 pm
Location: Karachi
Contact:

Post by saquib_javed »

disagree

approach is wrong

that guy dont wana use the filesystem

infact in my final year lecture our teacher gave us assignment on this we did it by storing the path of the file but our teacher said 'NO'

:idea:
Use Linux and feel Free.
OR
Feel free to use Linux. ;)
farhantoqeer
Major General
Posts: 917
Joined: Thu Jun 27, 2002 5:45 pm
Location: Karachi
Contact:

Post by farhantoqeer »

how did he defend his No?

What was the scenario?
A: Yes
Q: Is top-posting bad?
saquib_javed
Naib Subedar
Posts: 344
Joined: Sat Apr 10, 2004 9:07 pm
Location: Karachi
Contact:

Post by saquib_javed »

Dear,

He said NO by giving the reason that if ur on remote system and u want to insert a particular image (from remote system) in databse then it should not store the path because it can be deleted by anyone or anything.

ThanX
Use Linux and feel Free.
OR
Feel free to use Linux. ;)
hassanmuneer
Lance Naik
Posts: 25
Joined: Fri Apr 09, 2004 4:41 pm
Location: Lahore

Sorry for the late response.

Post by hassanmuneer »

Thanks for the responses.
Last edited by hassanmuneer on Sat Aug 05, 2006 1:28 am, edited 1 time in total.
hassanmuneer
Lance Naik
Posts: 25
Joined: Fri Apr 09, 2004 4:41 pm
Location: Lahore

Post by hassanmuneer »

And both the solutions are right depend on the senario , we can save the pictures to the databases and we can also save the paths to the databases. But the later technique is uses in the web enviroment. to reduce the size of the database. But my question is if we save the images in DB or in file system we use the same resources of the system ( i mean storage). The senario is if i want to host my application is some US based server and use the database for storing the images it consume the same space as OS file system and what do you mean by heavy database.
DB are meant to store the information not for the meta data information.

i am waiting for your responses.
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

hassanmuneer wrote:But my question is if we save the images in DB or in file system we use the same resources of the system ( i mean storage).
no, you always use slightly more resources if you store them in a database: there's the overhead of database tables, indexes, etc. it's also slower to fetch images from a database, you can't get the web server to cache the images in memory (done automatically if the image is served from a local disk), etc. in other words, more cpu resources to serve an image.
The senario is if i want to host my application is some US based server and use the database for storing the images it consume the same space as OS file system and what do you mean by heavy database.
who said anything about a heavy database?
DB are meant to store the information not for the meta data information.
if you have to store a billion images (not unimaginable -- see sites like livejournal.com where paid users can upload hundreds of avatar-type pictures), you really don't want to store all that in a database.

besides, if you store the path to a file in the db, you're storing information: metadata is information.
Post Reply