Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2012
    Posts
    30

    Question Unanswered: Store html files in db2

    Hi All!

    What is the proper way t store html files in db2 - in clob field or in xml field?

    if there's xml field - how to proper insert string data in it.

    Thanks.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by Black Moon View Post

    What is the proper way t store html files in db2 - in clob field or in xml field?
    Are you sure all your HTML files are valid XML documents?

    Quote Originally Posted by Black Moon View Post
    if there's xml field - how to proper insert string data in it.
    Depends on your definition of "proper". I'd try an INSERT statement.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Oct 2012
    Posts
    30
    One of my table has DBCLOB field, which used for store html-file.
    But when I inserty value in this field DB2 removes all tags,
    f.e.
    <html>Some data</html>
    becomes
    Some data
    Current way - is to add 2 quotes(') before and after html string.
    That's the problem..

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by Black Moon View Post
    But when I inserty value in this field DB2 removes all tags,
    I find that hard to believe.
    ---
    "It does not work" is not a valid problem statement.

  5. #5
    Join Date
    Oct 2012
    Posts
    30
    Yes, yes you're right.
    Maybe such bug was through hibernate translator..

    So, another task -

    How correct return value from stored procedure
    Something like -
    CREATE OR REPLACE procedure dlib.Attach_CreateNew(in pName varchar(50), in pSz integer, in pData BLOB)
    DYNAMIC RESULT SETS 1
    LANGUAGE SQL
    begin
    DECLARE newid char(16) for bit data;
    SET newid = dlib.SYS_GUID();
    insert into dlib.dl_files(id, name, sz, data)
    values(newid, pName, pSz, pData);

    DECLARE file_cursor CURSOR WITH RETURN TO CLIENT FOR
    SELECT newid FROM SYSIBM.sysdummy1;
    OPEN file_cursor;
    end @
    Need to return newid value

  6. #6
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    If all you're returning is a single value, why not use an output parameter?
    ---
    "It does not work" is not a valid problem statement.

  7. #7
    Join Date
    Oct 2012
    Posts
    30
    Quote Originally Posted by n_i View Post
    If all you're returning is a single value, why not use an output parameter?
    Cause hibernate can't work with output params.
    That's why I need to return param through select.

  8. #8
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    OK, but can Hibernate work with result sets returned by stored procedures?
    ---
    "It does not work" is not a valid problem statement.

  9. #9
    Join Date
    Oct 2012
    Posts
    30
    Quote Originally Posted by n_i View Post
    OK, but can Hibernate work with result sets returned by stored procedures?
    Yes.
    Hibernate limitations -
    The stored procedure/function must return a resultset as the first out-parameter to be able to work with Hibernate

  10. #10
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by Black Moon View Post
    The stored procedure/function must return a resultset as the first out-parameter to be able to work with Hibernate
    You are contradicting yourself. Earlier you said that Hibernate did not support output parameters, now you say it requires an output parameter to return the result set...
    ---
    "It does not work" is not a valid problem statement.

  11. #11
    Join Date
    Oct 2012
    Posts
    30
    Quote Originally Posted by n_i View Post
    You are contradicting yourself. Earlier you said that Hibernate did not support output parameters, now you say it requires an output parameter to return the result set...
    This means that usual output params from procedure
    Code:
    Pocedure Test(in p1, out p2, out p3 ...)
    wouldn't work with hibernate

    only
    Code:
    result =  CALL Test(p1)
    works

Posting Permissions

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