Re: binary into blob
> hehe, well said and sorry for the top-posting. > I can only agree, both methods have their merits! :) > > Alec Seems I started quite a debate ;) I wanted to thank you all again for your opinion and for planting a new seed of doubt on which direction I'll go ;) I setup the db as proposed earlier using paths and file names to find the pdf, but I might read the article posted by 'colbey' and give it a go for technical curiosity. Thank you all again for your responses. -Ed -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
Kevin Hunter wrote: Grrr. All you lazy top-posters! ;) It seems to me that a case can be legitimately made for both methods of handling BLOBs. On the one hand, where speed and/or efficiency (on many different levels) are the top priorities, it'd be good to keep the DB as trim as possible. On the other hand, if security is the top priority, you'd better keep all your data encrypted and in the DB. And as I wrote this, colbey explains this well in his email of 4:06p. It seems to me that the point is to use the correct tool for the job at hand. Computers have many tools, so no sense in turning everything into a proverbial nail head. Kevin hehe, well said and sorry for the top-posting. I can only agree, both methods have their merits! :) Alec -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
On 07 Mar 2007 at 3:57p -0500, Alexander Lind wrote: imagine a large system where pdf-files are accessed by clients a lot. say 1 pdf file is access per second on average. also say that your database is on a machine separate from the webserver(s) (as is common). do you really think its a good idea to pump the pdf data from the db each time it needs to be accessed? it may seem easier to do this as you then would not have to replicate the physical files across the webserver machines, but i would not say that the slight increase of ease is worth the added load to the db and the network. following your reasoning, you'd also store all images in the db so that you don't have to replicate these either? what is unsafe about having a pdf file on a webserver (not in a place where the httpd can access it of course)? alec [EMAIL PROTECTED] wrote: I have to disagree with most, I would store the entire file in the database, metadata and all. Better security, if you have a backend database, it's much harder to get the data than pdf's sitting in a directory on the webserver. Plus if you ever want to scale to a multi-webserver environment, the db storage works great. On Wed, 7 Mar 2007, Ed wrote: On Wednesday 07 March 2007 21:26, Alexander Lind wrote: I would put the pdf as a regular file on the hd, and store the path to it in the db. Meta data could be things like the size of the pdf, author, owner, number of pages etc. Storing binary data from pdf:s or images or any other common binary format is generally not a good idea. Alec Thank you all for your help. I get the gist of things... don't store the binnary, store the path to it and details of it. Thank you all for your quick response. -Ed Grrr. All you lazy top-posters! ;) It seems to me that a case can be legitimately made for both methods of handling BLOBs. On the one hand, where speed and/or efficiency (on many different levels) are the top priorities, it'd be good to keep the DB as trim as possible. On the other hand, if security is the top priority, you'd better keep all your data encrypted and in the DB. And as I wrote this, colbey explains this well in his email of 4:06p. It seems to me that the point is to use the correct tool for the job at hand. Computers have many tools, so no sense in turning everything into a proverbial nail head. Kevin -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
I've built systems than stream tons of data via this method, at times into some impressive requests per second. Also I've exposed files stored in this manner via a ftp interface with servers able to deliver near wire speed data in and out of the db storage. When your into a load balanced environment, you have a private network/vlan between the webservers backend and the database servers. 100mbit link/segment dedicated to db traffic. No bottle neck there. You are right about streaming the same file again and again, but is this really a real world scenario in all apps. If your app leans in this direction, you can do some temporary caching on the webserver end (maybe in memory cache, or if your running a java container, just throw the objects into memory for a timespan, before deleting and re-fetching. If someone gains access to a webserver, they can walk around and steal all source code/files on the webserver (including your pdf's) .. If you were running compiled java code, or encoded php code (with connection strings in php) that would be alot more difficult for them to access the data. I had a very large filesystem storage project, which the file management/scalability/expandability just got out of hand. Migrating to db storage solved that totally and I've never looked back. On Wed, 7 Mar 2007, Alexander Lind wrote: > imagine a large system where pdf-files are accessed by clients a lot. > say 1 pdf file is access per second on average. > > also say that your database is on a machine separate from the > webserver(s) (as is common). > > do you really think its a good idea to pump the pdf data from the db > each time it needs to be accessed? > > it may seem easier to do this as you then would not have to replicate > the physical files across the webserver machines, but i would not say > that the slight increase of ease is worth the added load to the db and > the network. > following your reasoning, you'd also store all images in the db so that > you don't have to replicate these either? > > what is unsafe about having a pdf file on a webserver (not in a place > where the httpd can access it of course)? > > alec > > [EMAIL PROTECTED] wrote: > > I have to disagree with most, I would store the entire file in the > > database, metadata and all. Better security, if you have a backend > > database, it's much harder to get the data than pdf's sitting in a > > directory on the webserver. Plus if you ever want to scale to a > > multi-webserver environment, the db storage works great. > > > > > > On Wed, 7 Mar 2007, Ed wrote: > > > > > >> On Wednesday 07 March 2007 21:26, Alexander Lind wrote: > >> > >>> I would put the pdf as a regular file on the hd, and store the path to > >>> it in the db. > >>> Meta data could be things like the size of the pdf, author, owner, > >>> number of pages etc. > >>> > >>> Storing binary data from pdf:s or images or any other common binary > >>> format is generally not a good idea. > >>> > >>> Alec > >>> > >> Thank you all for your help. I get the gist of things... don't store the > >> binnary, store the path to it and details of it. > >> > >> Thank you all for your quick response. > >> -Ed > >> > >> -- > >> MySQL General Mailing List > >> For list archives: http://lists.mysql.com/mysql > >> To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > >> > >> > > > > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
imagine a large system where pdf-files are accessed by clients a lot. say 1 pdf file is access per second on average. also say that your database is on a machine separate from the webserver(s) (as is common). do you really think its a good idea to pump the pdf data from the db each time it needs to be accessed? it may seem easier to do this as you then would not have to replicate the physical files across the webserver machines, but i would not say that the slight increase of ease is worth the added load to the db and the network. following your reasoning, you'd also store all images in the db so that you don't have to replicate these either? what is unsafe about having a pdf file on a webserver (not in a place where the httpd can access it of course)? alec [EMAIL PROTECTED] wrote: I have to disagree with most, I would store the entire file in the database, metadata and all. Better security, if you have a backend database, it's much harder to get the data than pdf's sitting in a directory on the webserver. Plus if you ever want to scale to a multi-webserver environment, the db storage works great. On Wed, 7 Mar 2007, Ed wrote: On Wednesday 07 March 2007 21:26, Alexander Lind wrote: I would put the pdf as a regular file on the hd, and store the path to it in the db. Meta data could be things like the size of the pdf, author, owner, number of pages etc. Storing binary data from pdf:s or images or any other common binary format is generally not a good idea. Alec Thank you all for your help. I get the gist of things... don't store the binnary, store the path to it and details of it. Thank you all for your quick response. -Ed -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
I have to disagree with most, I would store the entire file in the database, metadata and all. Better security, if you have a backend database, it's much harder to get the data than pdf's sitting in a directory on the webserver. Plus if you ever want to scale to a multi-webserver environment, the db storage works great. On Wed, 7 Mar 2007, Ed wrote: > On Wednesday 07 March 2007 21:26, Alexander Lind wrote: > > I would put the pdf as a regular file on the hd, and store the path to > > it in the db. > > Meta data could be things like the size of the pdf, author, owner, > > number of pages etc. > > > > Storing binary data from pdf:s or images or any other common binary > > format is generally not a good idea. > > > > Alec > > Thank you all for your help. I get the gist of things... don't store the > binnary, store the path to it and details of it. > > Thank you all for your quick response. > -Ed > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
Here's a great article on how to store pdf/whatever binary as blob chunks: http://www.dreamwerx.net/phpforum/?id=1 On Wed, 7 Mar 2007, Jay Pipes wrote: > Ed wrote: > > Hi All, > > I'm trying to figure out how to put a pdf file into a blob field. > > > > I guess a pdf file is a binnary file and it will contain characters that > > will > > mess things up, so my question is: > > > > can it be done? Or better, how can it be done? ;) > > > > Any pointers to documentation are a bonus! > > Is there a specific reason you want to store this in a database? Why > not use the local (or networked) file system and simply store the > metadata about the PDF in the database? > > Cheers, > > Jay > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
On Wednesday 07 March 2007 21:26, Alexander Lind wrote: > I would put the pdf as a regular file on the hd, and store the path to > it in the db. > Meta data could be things like the size of the pdf, author, owner, > number of pages etc. > > Storing binary data from pdf:s or images or any other common binary > format is generally not a good idea. > > Alec Thank you all for your help. I get the gist of things... don't store the binnary, store the path to it and details of it. Thank you all for your quick response. -Ed -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
Ed wrote: > On Wednesday 07 March 2007 19:28, Jay Pipes wrote: >> Is there a specific reason you want to store this in a database? Why >> not use the local (or networked) file system and simply store the >> metadata about the PDF in the database? >> >> Cheers, >> >> Jay > > Hi Jay, > Could you explain what you mean by metadata and how you would do it? > Thanks > -Ed > Pretty much you store all the info about the file (since this is billing maybe a billing number customer id etc) then you would reference a path to the file (could be just a name or a full path.) I've done this with images. Stored height, width and file name (along with an ID.) The file name was just that, no path (everything was relative to a 'main' images directory but you can lay it out however you like.) This is usually easier on web apps to do this. You don't have gobs of info in a db, and anybody can backup/restore files. I can see other reasons not to keep them on a file system and on a DB (like cross site) but even then, with the proper replication scheme that can be worked out as well. -- Thanks, James -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
i think he means you store only the name of the document and the directory location of where it is located. -Original Message- >From: Ed <[EMAIL PROTECTED]> >Sent: Mar 7, 2007 3:15 PM >To: mysql@lists.mysql.com >Subject: Re: binary into blob > >On Wednesday 07 March 2007 19:28, Jay Pipes wrote: >> Is there a specific reason you want to store this in a database? Why >> not use the local (or networked) file system and simply store the >> metadata about the PDF in the database? >> >> Cheers, >> >> Jay > >Hi Jay, >Could you explain what you mean by metadata and how you would do it? >Thanks > -Ed > >-- >MySQL General Mailing List >For list archives: http://lists.mysql.com/mysql >To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
I would put the pdf as a regular file on the hd, and store the path to it in the db. Meta data could be things like the size of the pdf, author, owner, number of pages etc. Storing binary data from pdf:s or images or any other common binary format is generally not a good idea. Alec Ed wrote: On Wednesday 07 March 2007 19:28, Jay Pipes wrote: Is there a specific reason you want to store this in a database? Why not use the local (or networked) file system and simply store the metadata about the PDF in the database? Cheers, Jay Hi Jay, Could you explain what you mean by metadata and how you would do it? Thanks -Ed
Re: binary into blob
On Wednesday 07 March 2007 19:28, Jay Pipes wrote: > Is there a specific reason you want to store this in a database? Why > not use the local (or networked) file system and simply store the > metadata about the PDF in the database? > > Cheers, > > Jay Hi Jay, Could you explain what you mean by metadata and how you would do it? Thanks -Ed -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
On Wednesday 07 March 2007 19:28, Jay Pipes wrote: > Ed wrote: > > I guess a pdf file is a binnary file and it will contain characters that > > will mess things up, so my question is: > > Hi, sorry for the late answer. The reason, until I come up with a better one, is that I'm doing my own basic accounting db and I'd like my bills to be available. So that a specific bill can easily be retrieved. Your thoughts ;) -Ed -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: binary into blob
Ed wrote: Hi All, I'm trying to figure out how to put a pdf file into a blob field. I guess a pdf file is a binnary file and it will contain characters that will mess things up, so my question is: can it be done? Or better, how can it be done? ;) Any pointers to documentation are a bonus! Is there a specific reason you want to store this in a database? Why not use the local (or networked) file system and simply store the metadata about the PDF in the database? Cheers, Jay -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
binary into blob
Hi All, I'm trying to figure out how to put a pdf file into a blob field. I guess a pdf file is a binnary file and it will contain characters that will mess things up, so my question is: can it be done? Or better, how can it be done? ;) Any pointers to documentation are a bonus! Thanks all, -Ed -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]