dcsimg
Results 1 to 6 of 6

Thread: retrieving images from a remote computer

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2013
    Posts
    20

    retrieving images from a remote computer

    i have develop an application which make use of Microsoft SQL Sever 2008. i store data in this database and store location of images in a table in the database. The application get the location of the image from the database and display the images. but when i use the application on a different computer other than where the database is installed the images wont display, because the images are not at the current location on the computer. is it advisable to store the pictures as bits in the database and retrieve it remotely if not then how can i get over this. i connect to the database remotely

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,490

    Re: retrieving images from a remote computer

    It's often said that storing images and other large binary objects in a database is inadvisable because it makes the data file much larger and therefore less efficient. That is indeed true but later versions of SQL Server have provided a solution to that issue. If you can enable the FILESTREAM feature of the instance then you can write your application to save the binary data directly to the database, just as you would with any other data, but SQL Server will actually store the data external to the MDF file, keeping it lean and mean.

    Alternatively, if you want to keep doing things the way you are, you can create a network share on that machine and then use the UNC path of that share as the root of your file path. That way, any machine on the network will be able to retrieve the file using the same path.

    I'd recommend the first option as the better of the two but it may be that you can implement the second option with basically no code changes.

  3. #3
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,707

    Re: retrieving images from a remote computer

    I'd recommend the first option as the better of the two
    I would complete agree. Why create a remote connection only to require shared resources?

    In your case it sounds like you have stored the image location that is referenced to the db server. If so, and if you retrieve the location of the image on any other machine it would certainly fail
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jun 2013
    Posts
    20

    Re: retrieving images from a remote computer

    Thank you very much using Filestream did the magic, but i have one problem when you call a normal delete on a row the images are still on disk how can i delete them. DO i have to
    create a sub to delete them myself.

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,490

    Re: retrieving images from a remote computer

    http://technet.microsoft.com/en-us/l...QL.105%29.aspx
    When a FILESTREAM field is set to NULL, the BLOB data associated with the field is deleted.
    When you delete a row or delete or truncate a table that contains FILESTREAM data, you delete the underlying BLOB data in the file system.
    It would appear that you don't have to do anything beyond a normal database operation to delete the data.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jun 2013
    Posts
    20

    Re: retrieving images from a remote computer

    Thanks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width