dwg file in sql

Discussion in 'AutoCAD' started by kishore1981, Mar 18, 2005.

  1. kishore1981

    kishore1981 Guest

    hi ,
    i want to know how to store the dwg file in sql database..
    and getback.

    please help me in this regard

    kishore
     
    kishore1981, Mar 18, 2005
    #1
  2. hi hishore,


    by default database-server are only built to store/search values of type text/number/boolean.
    so you need a database-server/-software that can store geometry.

    before we can discuss the (many) different ways we need to know what sql-server-product?

    - alfred -
     
    Alfred NESWADBA, Mar 18, 2005
    #2
  3. kishore1981

    Norman Yuan Guest

    You certainly can do it. Such data saved in database is called BLOB (Binary
    Large OBject). Many (most?) database developers are against saving file in
    database as binary data, especially when the file size is fairly big, such
    as AutoCAD drawing. They recommend to save file path/name in databae
    instead.

    Simply search MS Knowledge Base for "BLOB", you will get everything yu want
    to know on how to save/retrieve BLOB from SQL Server database/Jet database.
     
    Norman Yuan, Mar 18, 2005
    #3
  4. norman,

    that's why i asked a few additional questions. just to save dwgs as blobs
    into a database is the really last choice i would use, because there is
    no advantage against saving dwg in standard filesystem. so you could not
    search for any coordiantes/blockrefs/attributes/text/layernames/...

    let's wait for the answer from kishore

    - alfred -
     
    Alfred NESWADBA, Mar 18, 2005
    #4
  5. kishore1981

    Wyatt Earp Guest

    You need to create an "Image" data field in a sql table (at least
    that's what MS-SQL Server calls it) and stick the filebytes of the file
    in there.
     
    Wyatt Earp, Mar 18, 2005
    #5
  6. kishore1981

    kishore1981 Guest

    hi all,
    thanks for ur replies . but i did not got the solution

    let me brief about my requirement .

    i want to control the versions of every dwg file . copying in a different folders is not solving this problem
    and it is giving me headace to find the which version is the correct one . and more as data in folder is not more safest than the data in sql server.

    so i hope u got my problem.

    please help me to store the dwg file in sql. i got the code for image storing in sql but that is not working out for dwg file.

    thanks and regards
    kishore chinna
     
    kishore1981, Mar 19, 2005
    #6
  7. hi,

    as already mentioned i think just to move a dwg file into a blob-field of a database
    is not (my) preferred way.

    my suggestion (one of maybe hundreds of possibilities):
    i would hold information of filenames and correspondig
    file- & version-information in the database,
    so the user gets search-funktions to find the drawing-record.
    in the drawingrecord you have the filename and your app
    can control the opening of the specific file.

    if you want to restrict access to old revisions of a dwg, then you
    can add a rename function of files and replace for example the
    file extension against the version-number (for example "filename.dwg.ver001")


    the advantages:
    the user has access to xref's (not if they are not in filesystem)
    the user can open dwg's faster (no copy from database-blob to filesystem)



    if you want to stay on your solution, then you are in the wrong newsgroup
    because that question is not autocad-specific, search at microsoft or
    google on how to read/write blobs.

    http://support.microsoft.com/default.aspx?scid=kb;en-us;317016

    - alfred -
     
    Alfred NESWADBA, Mar 19, 2005
    #7
  8. Sounds like you're trying to replicate Autodesk Vault or any number of
    off-the-shelf PDM products. It would most likely be a far more efficient
    use of your time to purchase a ready-made solution.

    However, if you simply must go this route you should know that a DWG
    file can be stored only as a BLOB and not any form of indexable,
    seachable data. After all, it is simply a single binary object.

    Instead, your database should contain the location of the file and
    record data describing the DWG such as document properties.
     
    Frank Oquendo, Mar 19, 2005
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.