Suggestion on using image data type in sql 2005.
-
Dear All, My requirement contains an windows application that can be installed any where over the world but the server will be in one place which will be accessed via internet. Note : the same db will be accessed from web application also for reporting. I plan to use MSSQL 2005 version and my db has image datatype also. i am using the image data type in the db, when i try to query this it is taking more time for replying... is it advisable to use the same? or is there any way to accomplish the same by using any other data types.. i tried usign varbinary (max) now the perfomance is little better than that.. but still slow. Please guide me . thanks in advance.
-
Dear All, My requirement contains an windows application that can be installed any where over the world but the server will be in one place which will be accessed via internet. Note : the same db will be accessed from web application also for reporting. I plan to use MSSQL 2005 version and my db has image datatype also. i am using the image data type in the db, when i try to query this it is taking more time for replying... is it advisable to use the same? or is there any way to accomplish the same by using any other data types.. i tried usign varbinary (max) now the perfomance is little better than that.. but still slow. Please guide me . thanks in advance.
If your purpose is to store files in the database, I would suggest you store the files in the file system and just store the path to the files in the database in a varchar column. Serving files from the file system is much faster than serving it from the database. The are pros and cons to both approaches. You may want to do some research and benchmarks before deciding which one to use.
-
If your purpose is to store files in the database, I would suggest you store the files in the file system and just store the path to the files in the database in a varchar column. Serving files from the file system is much faster than serving it from the database. The are pros and cons to both approaches. You may want to do some research and benchmarks before deciding which one to use.
Dear Shameel, First of thank you very much for your time to reply. Actually its not an file storage its an data storing.. say for example i want to store the details of an employe like name, age,sex ,address,... and his/her PHOTO... so here comes the image plays the role.. so this is the requirement. am bit confused to use the general MSSQL server to use it from internet as it will create problem by perfomance..or something. thanks
-
Dear Shameel, First of thank you very much for your time to reply. Actually its not an file storage its an data storing.. say for example i want to store the details of an employe like name, age,sex ,address,... and his/her PHOTO... so here comes the image plays the role.. so this is the requirement. am bit confused to use the general MSSQL server to use it from internet as it will create problem by perfomance..or something. thanks
Hi Hema, Shameel is quite correct you can store in web server it self. But in security concerns it will not quite good but you can achieve that also by providing a user and giving read/write permission for that user and use it while storing it in web server. If you still want to use it please put (nolock) while you are retrieving information of image or any thing as you said same db is using for reporting.
-
Dear Shameel, First of thank you very much for your time to reply. Actually its not an file storage its an data storing.. say for example i want to store the details of an employe like name, age,sex ,address,... and his/her PHOTO... so here comes the image plays the role.. so this is the requirement. am bit confused to use the general MSSQL server to use it from internet as it will create problem by perfomance..or something. thanks
Information like name, age, sex, etc. can be stored using appropriate data types like varchar, int, etc. Photos can be stored using two ways: One is to store the photo as binary information in an image column. The other is to store the photos as jpeg images on the file system and store their paths in a varchar column. Each of these approaches have advantages and disadvantages of their own, you may want to explore these options further and see what works for your situation.
-
Information like name, age, sex, etc. can be stored using appropriate data types like varchar, int, etc. Photos can be stored using two ways: One is to store the photo as binary information in an image column. The other is to store the photos as jpeg images on the file system and store their paths in a varchar column. Each of these approaches have advantages and disadvantages of their own, you may want to explore these options further and see what works for your situation.
once again thanks to you and shameel for your time in replying. as you peoples mentioned i can save the file in the web server. But as i mentioned earlier i will be using the windows application to save the images and i will retriving the same in windows application. In that case i need to share the folder (to all the machines ??? ) rt..it may cause security violation.. so there is only one way to store is database rt? so i need to compromise the perfomance of the applcication...
-
once again thanks to you and shameel for your time in replying. as you peoples mentioned i can save the file in the web server. But as i mentioned earlier i will be using the windows application to save the images and i will retriving the same in windows application. In that case i need to share the folder (to all the machines ??? ) rt..it may cause security violation.. so there is only one way to store is database rt? so i need to compromise the perfomance of the applcication...
-
Hema Bairavan wrote:
In that case i need to share the folder (to all the machines ??? )
No, you don't have to and you should not. You can build a web service that serves images. Google can help you find code samples to get you started.
thanks shameel.. i will check that case and get back to you.. thanks in advance
-
Dear All, My requirement contains an windows application that can be installed any where over the world but the server will be in one place which will be accessed via internet. Note : the same db will be accessed from web application also for reporting. I plan to use MSSQL 2005 version and my db has image datatype also. i am using the image data type in the db, when i try to query this it is taking more time for replying... is it advisable to use the same? or is there any way to accomplish the same by using any other data types.. i tried usign varbinary (max) now the perfomance is little better than that.. but still slow. Please guide me . thanks in advance.
You may want to look into writing a Web Service (WCF) and access that from your clients. I agree with putting the image in the database (I don't trust the file system), but you should only access it when you need it, not every time you access the record. I also suggest you put the images in a separate table.
-
Dear All, My requirement contains an windows application that can be installed any where over the world but the server will be in one place which will be accessed via internet. Note : the same db will be accessed from web application also for reporting. I plan to use MSSQL 2005 version and my db has image datatype also. i am using the image data type in the db, when i try to query this it is taking more time for replying... is it advisable to use the same? or is there any way to accomplish the same by using any other data types.. i tried usign varbinary (max) now the perfomance is little better than that.. but still slow. Please guide me . thanks in advance.
Hema Bairavan wrote:
is it advisable to use the same? or is there any way to accomplish the same by using any other data types.. i tried usign varbinary (max) now the perfomance is little better than that.. but still slow.
It's slow because you're fetching a blob from the database. Host it on a webserver and store the path, you'll find that the browser simply caches the picture.
Bastard Programmer from Hell :suss:
-
You may want to look into writing a Web Service (WCF) and access that from your clients. I agree with putting the image in the database (I don't trust the file system), but you should only access it when you need it, not every time you access the record. I also suggest you put the images in a separate table.
PIEBALDconsult wrote:
I don't trust the file system
And where do you persist your database? Even if it is on a good old magtape, that still probably implies a file system of some kind. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
Dear All, My requirement contains an windows application that can be installed any where over the world but the server will be in one place which will be accessed via internet. Note : the same db will be accessed from web application also for reporting. I plan to use MSSQL 2005 version and my db has image datatype also. i am using the image data type in the db, when i try to query this it is taking more time for replying... is it advisable to use the same? or is there any way to accomplish the same by using any other data types.. i tried usign varbinary (max) now the perfomance is little better than that.. but still slow. Please guide me . thanks in advance.
Agree with other 3 members. Also I prefer Filesystem instead of BLOB. Check this post, explained things clearly. Storing Uploaded Files in a Database or in the File System with ASP.NET[^]
thatraja
My Dad had a Heart Attack on this day so don't...
Pompeyboy3 here | Nobody remains a virgin, Life screws everyone :sigh: -
PIEBALDconsult wrote:
I don't trust the file system
And where do you persist your database? Even if it is on a good old magtape, that still probably implies a file system of some kind. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
-
Dear All, My requirement contains an windows application that can be installed any where over the world but the server will be in one place which will be accessed via internet. Note : the same db will be accessed from web application also for reporting. I plan to use MSSQL 2005 version and my db has image datatype also. i am using the image data type in the db, when i try to query this it is taking more time for replying... is it advisable to use the same? or is there any way to accomplish the same by using any other data types.. i tried usign varbinary (max) now the perfomance is little better than that.. but still slow. Please guide me . thanks in advance.
-
PIEBALDconsult wrote:
I don't trust the file system
And where do you persist your database? Even if it is on a good old magtape, that still probably implies a file system of some kind. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
Trusting it not to lose one big file is one thing, also trusting it not to lose many small ones is another. (Easier to back up too.)