Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Suggestion on using image data type in sql 2005.

Suggestion on using image data type in sql 2005.

Scheduled Pinned Locked Moved Database
databasesql-serversysadmintutorialquestion
15 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Hema Bairavan

    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

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #5

    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.

    H 1 Reply Last reply
    0
    • L Lost User

      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.

      H Offline
      H Offline
      Hema Bairavan
      wrote on last edited by
      #6

      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...

      L 1 Reply Last reply
      0
      • H Hema Bairavan

        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...

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #7

        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.

        H 1 Reply Last reply
        0
        • L Lost User

          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.

          H Offline
          H Offline
          Hema Bairavan
          wrote on last edited by
          #8

          thanks shameel.. i will check that case and get back to you.. thanks in advance

          1 Reply Last reply
          0
          • H Hema Bairavan

            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.

            P Online
            P Online
            PIEBALDconsult
            wrote on last edited by
            #9

            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.

            L 1 Reply Last reply
            0
            • H Hema Bairavan

              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.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #10

              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:

              1 Reply Last reply
              0
              • P PIEBALDconsult

                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.

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #11

                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

                J P 2 Replies Last reply
                0
                • H Hema Bairavan

                  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.

                  T Offline
                  T Offline
                  thatraja
                  wrote on last edited by
                  #12

                  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:

                  1 Reply Last reply
                  0
                  • L Luc Pattyn

                    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

                    J Offline
                    J Offline
                    Jorgen Andersson
                    wrote on last edited by
                    #13

                    File system, bah, humbug[^].

                    Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

                    1 Reply Last reply
                    0
                    • H Hema Bairavan

                      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.

                      S Offline
                      S Offline
                      SilimSayo
                      wrote on last edited by
                      #14

                      If you chose to store the images in the database, you could improve performance by optimising your queries and also retrieving images only when needed e.g. user clicks some button to see/view image.

                      1 Reply Last reply
                      0
                      • L Luc Pattyn

                        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

                        P Online
                        P Online
                        PIEBALDconsult
                        wrote on last edited by
                        #15

                        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.)

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups