Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2002
    Posts
    4

    Unanswered: occi demos heap error

    Built the occiclob demo in msvc 6.0, starts to run and always gets a exception on the first stmt->setsql call, if I skip these the three updates work but then it dies on the conn->terminateStatement with another heap error. Any ideas, I've tried multi and single threaded, changed sruct alignment all to no avail.

    void insertRows (Connection *conn)
    throw (SQLException)
    {
    Statement *stmt = conn->createStatement ("INSERT INTO electronic_media(product_id,ad_id,ad_composite,ad_ sourcetext) VALUES (:v1,:v2,:v3,:v4)");
    Blob blob(conn);
    blob.setEmpty();
    Clob clob(conn);
    clob.setEmpty();
    stmt->setInt(1,6666);
    stmt->setInt(2,11001);
    stmt->setBlob(3,blob);
    stmt->setClob(4,clob);
    stmt->executeUpdate();
    stmt->setSQL ("INSERT INTO electronic_media(product_id,ad_id,ad_composite,ad_ sourcetext) VALUES (:v1, :v2, :v3, :v4)");
    stmt->setInt(1,7777);
    stmt->setInt(2,11001);
    stmt->setBlob(3,blob);
    stmt->setClob(4,clob);
    stmt->executeUpdate();
    stmt->setSQL ("INSERT INTO electronic_media(product_id,ad_id,ad_composite,ad_ sourcetext) VALUES (:v1, :v2, :v3, :v4)");
    stmt->setInt(1,8888);
    stmt->setInt(2,11001);
    stmt->setBlob(3,blob);
    stmt->setClob(4,clob);
    stmt->executeUpdate();
    conn->commit();
    conn->terminateStatement (stmt);

    }

  2. #2
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    Hello popkin,

    What exact exception do you get in these two cases ? (with setSQL and without) Please be more precise.

    Regards,

    RBARAER

  3. #3
    Join Date
    Apr 2002
    Posts
    4
    Message Box:

    User breakpoint called from code at 0x77f75a58

    The debug window shows the following error:

    HEAP[occiclob.exe]: Invalid Address specified to RtlFreeHeap( 003C0000, 00B32868 )

    Call Stack:

    NTDLL! 77f75a58()
    NTDLL! 77f9e139()
    NTDLL! 77f85010()
    NTDLL! 77f58b37()
    MSVCRT! 77c2ab2e()
    operator delete(void * 0x00b32868) line 6 + 10 bytes
    std::basic_string<char,std::char_traits<char>,std: :allocator<char> >::_Tidy(std::basic_string<char,std::char_traits<c har>,std::allocator<char> > * const 0x77f75c17 {0x00000260 ""}, unsigned char 1) line 591 + 6 bytes
    std::basic_string<char,std::char_traits<char>,std: :allocator<char> >::assign(std::basic_string<char,std::char_traits< char>,std::allocator<char> > * const 0x77f75c17 {0x00000260 ""}, const std::basic_string<char,std::char_traits<char>,std: :allocator<char> > & {0x00b32931 "INSERT INTO electronic_media(product_id,ad_id,ad_composite,ad_ sourcetext) VALUES (:v1, :v2, :v3, :v4)"}, ...) li
    ORAOCCI9! 60877964()
    occiClob::insertRows(oracle:cci::Connection * 0x00b77b78) line 53 + 48 bytes
    occiClob::runSample() line 234
    main() line 427
    mainCRTStartup() line 206 + 25 bytes
    KERNEL32! 77e8141a()

  4. #4
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    If you catch the SQLException, what text do you get ? It might be more useful than the call stack trace here. Try not to throw the SQLException, but to issue a "try catch", maybe several ones to point out more precisely where the exception is thrown.

    BTW, you don't have to restate setSQL if your query is the same : it is a loss of time. Note that if you want to execute the same query many times with different parameter values, you should modify rows iteratively. See here.

    Another piece of advice, I prefer to use setDataBuffer than setXXX methods, because the setXXX methods copy data in a new variable at each call, while setDataBuffer does not. See here for more details.

    Regards,

    RBARAER

  5. #5
    Join Date
    Apr 2002
    Posts
    4
    It's not a SQLException, the heap error occurs in NTDLL.DLL. I did add a try and catch to make sure though. Never gets to the catch.

    Thanks for pointing out the other more efficient techniques, I am new to occi, was hoping to replace a system that uses ADO/OLE DB for oracle access. The oracle ole db provider is so slow it may become unusable.

    Thought I could use the sample they provided to get going (should have known better).

    Do you think I would be better off with standard OCI?

  6. #6
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    Do you think I would be better off with standard OCI?
    I don't think so, but maybe. I'm currently developing an application using OCCI. I'm pretty happy concerning performance, and provided you use optimization techniques such as the ones I pointed to you, you will be happy too. However, be wary that I experienced some sort of memory leaks using OCCI 9. I don't have the latest patches for Oracle 9i, but it seems they correct that. As for OCI, I hesitated a little at the beginning, but as i was already familiar to JDBC, and OCCI looks pretty much like JDBC in terms of code, I think it would have taken much more time to do it using OCI (you'll have about 10 to 15 lines only to create your connection, while you need 2 in OCCI, and you will even more work with pointers of pointers... ). It depends if you are fond of pure C or not. If you are not, I'd say : go for OCCI.

    Now, concerning your problem, I'm sorry but I don't know where it comes from... hard to tell since it doesn't seem to be an OCCI error (would have been an SQLException)... You can try this : instead of using 2 bind variables for your CLOB and BLOB, try to replace them in your query with empty_clob() and empty_blob() respectively, and see if you still get this error. Like this :
    Code:
    Statement *stmt = conn->createStatement ("INSERT INTO electronic_media(product_id,ad_id,ad_composite,ad_ sourcetext) VALUES (:v1,:v2,empty_blob(),empty_clob())");
    HTH and Regards,

    RBARAER

  7. #7
    Join Date
    Apr 2002
    Posts
    4
    Thanks, for the time and advice, I'll post the results of the ADO to OCCI comparison when completed.

Posting Permissions

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