Invalid OCI handle when creating a Blob

I have an application that talks to an Oracle 11gR2 database. I am using the OCCI C++ library. I can call SPs with no problem when they do not contain a Blob. Now I need to pass in a Blob to a SP and I am getting an ORA-32102: invalid OCI handle exception thrown when I call blob->open(OCCI_LOB_WRITEONLY). This same style of code works when I call a SP that does not have a Blob parameter so naturally I am confused. What could be wrong with this?
Thanks,
Aaron
FYI, Here's the code segment in question
Statement *statement;    
try {
     // create the connection
     statement = myconnection->createStatement();
     // create the start timestamp
     // create the end timestamp
     // create the blob of data
     blob = new Blob(myconnection);
     blob->open(OCCI_LOB_WRITEONLY);  // <---------------------------------------- here the exception ORA-32102 is thrown
     blob->write(packSize,(uint8_t*)dataBlock,dataBlockSize);
     blob->close();
     // create statement and set input parameters
     statement->setSQL("BEGIN network_analysis.update_network_ip(:1,:2,:3,:4,:5); END;");
     statement->setInt(1,dbconnect->networkMetricId);
     statement->setTimestamp(2,startTime);
     statement->setTimestamp(3,endTime);
     statement->setBlob(4,*blob); // setBlob 2nd parameter is a reference
     statement->setInt(5,numEntries);
     statement->executeUpdate();
} catch (SQLException &e) {
     FATALF("%s",e.what());
myconnection->terminateStatement(statement); // free resource
delete blob;Edited by: user8859202 on Dec 16, 2009 12:16 PM

Update, I found the answer which is streams must be used. The setBinaryStreamMode is used and after executeUpdate, I update the stream.

Similar Messages

  • Invalid OCI Handle when storing Blob in Oracle 11g with OCCI

    Hi,
    I'm getting Invalid OCI Handle ORA-32102 while execute the following code:
    try
                   env=Environment::createEnvironment(Environment::OBJECT);
                   connPool = env->createConnectionPool(userName, password,
                             database, minConn, maxConn, incrConn);
                   conn=connPool->createConnection(userName,password);
                   Blob blobRequest(conn);
                   blobRequest.open(OCCI_LOB_WRITEONLY);
                   unsigned int bytesReqWritten = blobRequest.write((unsigned int)bytesOut, req_buffer, (unsigned int)bytesOut);
                   cout << "Request bytes written "<< bytesReqWritten << endl;
                   blobRequest.close();
                   Blob blobResponse(conn);
                   blobResponse.open(OCCI_LOB_WRITEONLY);
                   unsigned int bytesRespWritten = blobResponse.write((unsigned int)bytesAckOut, resp_buffer, (unsigned int)bytesAckOut);
                   cout << "Response bytes written "<< bytesRespWritten << endl;
                   blobResponse.close();
                   stmt = conn->createStatement("BEGIN STORE_REQUEST(:1,:2); END;");
                   stmt->setBlob(1,blobRequest); <------------------------- Blob here
                   stmt->setBlob(2,blobResponse); <------------------------- Blob here
                   stmt->executeUpdate();
    catch(SQLException &e)
                   cout << "Error in Constructor Call " << endl;
                   cout << "Error Number: " << e.getErrorCode() << endl;
                   cout << e.getMessage() << endl;
         conn->terminateStatement(stmt);
         connPool->terminateConnection (conn);
         env->terminateConnectionPool (connPool);
         Environment::terminateEnvironment(env);
    Anyone can help me? Please.
    Kind Regards, denis

    Hi,
    The correct code for insert blobs must be writed like this:
    try
    env=Environment::createEnvironment(Environment::OBJECT);
    connPool = env->createConnectionPool(userName, password,
    database, minConn, maxConn, incrConn);
    conn=connPool->createConnection(userName,password);
    //1. First insert empty blobs in tables...
    Blob blobRequest;
    blobRequest.setEmpty(conn);
    Blob blobResponse;
    blobResponse.setEmpty(conn);
    stmt = conn->createStatement("BEGIN STORE_REQUEST(:1,:2); END;");
    stmt->setBlob(1,blobRequest);
    stmt->setBlob(2,blobResponse);
    stmt->executeUpdate();
    //2.Select Blobs for update and commit
    stmt2 = conn->createStatement("SELECT REQUEST,RESPONSE FROM STORE WHERE ID=:ID FOR UPDATE");
    stmt2->setString(1,id.c_str());
    ResultSet *rs = stmt2->executeQuery();
    if(rs->next())
    blobRequest = rs->getBlob(1);
    blobRequest.write((unsigned int)bytesOut, req_buffer, (unsigned int)bytesOut);
    blobResponse = rs->getBlob(2);
    blobResponse.write((unsigned int)bytesAckOut, resp_buffer, (unsigned int)bytesAckOut);
    conn->commit();
    else
    conn->rollback();
    catch(SQLException &e)
    cout << "Error in Constructor Call " << endl;
    cout << "Error Number: " << e.getErrorCode() << endl;
    cout << e.getMessage() << endl;
    stmt2->closeResultSet(rs);
    conn->terminateStatement(stmt);
    conn->terminateStatement(stmt2);
    connPool->terminateConnection (conn);
    env->terminateConnectionPool (connPool);
    Environment::terminateEnvironment(env);

  • OCCI Error -  ORA-32102: invalid OCI handle

    Hi,
    I'm completely new to OCCI and Linux and trying to run the simple OCCI program given in oracle site (http://www.oracle.com/technology/tech/oci/occi/occibasic.html) to connect a remote Oracle DB server.
    #include <iostream>
    #include <occi.h>
    using namespace std;
    using namespace oracle::occi;
    int main()
    Environment* env = Environment::createEnvironment();
    Connection* conn = env->createConnection("testdb", "testdb", "192.168.10.118:1521/ORADB"); // user, password, url
    Statement* stmt = conn->createStatement();
    stmt->setSQL("INSERT into FRUITS (fruit, amt) VALUES ('apple', 10)");
    stmt->executeUpdate();
    conn->terminateStatement(stmt);
    env->terminateConnection(conn);
    Environment::terminateEnvironment(env);
    return 0;
    When I try to run it after compilation it gives the following error.
    ORA-32102: invalid OCI handle
    The error should be in the line: Connection* conn = env->createConnection("testdb", "testdb", "192.168.10.118:1521/ORADB");
    I could track it by placing a cout<< there.
    Why this is and how can I handle this error? Please post your experience.
    Thanks

    Hi,
    I found the reason. It may due to the permission level of the user "testdb". When I tried with a different user it worked!
    Thanks

  • If createConnection hit "connection lost contact" then "invalid OCI handle"

    I am facing a peculiar error with OCCI API :
    The c++ application make use of OCCI API to interact with 10 different oracle DBs sequentially in loop, but the moment
    pConn = pEnv->createConnection(a_usr, a_pass, a_connection) for 1 slow db is hit with "ORA-03135: connection lost contact" then
    for all the remaining other db execution I get a constant error - "ORA-32102: invalid OCI handle" i.e
    when the control moves to next db then "pConn = pEnv->createConnection" is successful for all the rest db but when
    pRes = pStmt->executeQuery() is executed I get this - "ORA-32102: invalid OCI handle" standard error.
    The rest of dbs are live, cross checked with SQLPLUS.
    The OCCI resources and handlers are initialized in class and remains in memory till the end of the application. In healthy situation the application works fine for all10 dbs and handles all the ORA errors well except for this situation.
    Question: When OCCI hit ORA-03135 error in createConnection method , does OCCI releases the memory (or handlers) ..? If yes then with the same "env" handler why OCCI succeeds in making the next connection and we have correct "con" handler, similarly "createStatement" is also successful but this same "statement" handler the executeQuery() fails with -invalid OCI handle ??
    In healthy situation all logic works just fine, I am able to get the data that means sql queries and resultset handle code is perfect.
    Thanks in advance,
    Vijay

    If you haven't found a solution for this yet, could you post the entire section of code? Please use the code tag to post the code.

  • "Invalid Metadata Objects" when creating materialized views

    Hi experts,
    I have run into some trouble. I had an analytic workspace that grew too fast (see 11.2.0.2 AW size grows steadily with every cube build so I deleted it and created a new one.
    It seemed to build fine using the tip that David Greenfield gave us in the mentioned forum post, but when I try to enable materialized views (which I had enabled in the previous workspace) I'm gettig the following error:
    Your metadata changes have been saved, with the following errors
    Invalid Metadata Objects:
    Invalid Object "TABLESPACE.LECTURAS": "CREATE MATERIALIZED VIEW "TABLESPACE"."CB$LECTURAS"
    ORGANIZATION CUBE ON TABLESPACE.TABLESPACE_AW(
    FACT "LECTURAS_STORED"("LECTURAS_MEASURE_DIM" 'LECTURA') IS "LECTURA",
    DIMENSION "TIEMPO" IS "TIEMPO" USING "TIEMPO_TIEMPO_HOUR_ID_UNIQUE_KEY" ,
    DIMENSION "GEOGRAFIA" IS "GEOGRAFIA" USING "GEOGRAFIA_GEOGRAFIA_CONTADOR_ID_UNIQUE_KEY" )
    BUILD DEFERRED
    REFRESH ON DEMAND
    FORCE
    USING TRUSTED CONSTRAINTS
    AS
    SELECT
    TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') "TIEMPO",
    T1."COD_METERID" "GEOGRAFIA",
    SUM(T1."VAL_AI_HOR") "LECTURA"
    FROM
    TABLESPACE."LECTURA_HORARIA_FINAL" T1
    GROUP BY
    (TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') , T1."COD_METERID")
    ORA-00942: table or view does not exist
    Running this same script in SQLDeveloper yields the same error at line 17, which is the FROM clause. BUT I can run the SELECT statement by itself and returns the expected result. So the table exists in the correct tablespace.
    I must be missing something big...
    Thanks in advance.
    Joan
    P.S.: In the code above I'm using "TABLESPACE" in substitution for the real username and tablespace name (which is the same) for privacy reasons.

    When you ran the select statement, were you connected as the same user that you used to try to enable the MVs?
    Can you create a standard (non cube) MV with the same select statement? (Connected as the same user you used in AWM.)
    "CREATE MATERIALIZED VIEW "TABLESPACE"."MV_TEST"
      BUILD DEFERRED
      REFRESH ON DEMAND
      FORCE
      USING TRUSTED CONSTRAINTS
    AS
      SELECT
       TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') "TIEMPO",
       T1."COD_METERID" "GEOGRAFIA",
       SUM(T1."VAL_AI_HOR") "LECTURA"
      FROM
       TABLESPACE."LECTURA_HORARIA_FINAL" T1
      GROUP BY
       (TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') , T1."COD_METERID")
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error 'Invalid address style' when create new address Legal Entity R12

    Hi,
    Did somebody had the same problem like i do.
    I am trying to create a new dutch address for a new legal entity in Oracle R12.1.1 Vision, but however hard i trying to do so i always received the error message 'Invalid Address Style' and i filled in all the required field.
    When i tested with the country 'US' or 'Australia' is could create a new address without any problem.
    I hope you can help me to solve my problem.
    Thanks in advance...!!
    Wim

    Hello Sandeep,
    You were right, I checked the dff for the address style and activated the once for the countries I needed and now I can create new address for the required countries by using the legal entity configurator.
    Thanks for your help..!!
    Regards,
    Wim
    PS: Incase somebody else has they same problem, let me know and i send you the worddocument i made with the solution

  • ORA-32102 invalid OCI handle

    We are using the oracle::occi::Timestamp data type to format a timestamp. To create the Timestamp we need to call createEnvironment. We then want to clean up and terminateEnvironment, otherwise we leak memory. I'm receiving an ORA-32102 error and I'm not sure why. Has any one had experience with this? I'm calling timestamp.setNull() before calling terminateEnvironment(env). I am not creating any connections, statements, etc, just a Timestamp.

    can you post the sample code?

  • Invalid File Handle Windows 7 with Novell Client 2 SP1

    Hello!
    I have a user on Windows who gets "invalid file handle" when saving files in
    WordPerfect and possibly Adobe as well. He thinks it mostly occurs when he
    has multiple files open and has saved one open file to a different
    directory. Then if he goes to save another file in it's same directory, he
    gets the error. I hope this makes sense. Would anyone have any idea if it
    does make sense?
    Thanks!

    Maybe that was once the intention by novell, but I assure you that you
    will have no trouble finding a lot of people/exemples that proves the
    opposite...
    Yeah, you can set the server-side settings which do have an impact,
    on win7 stations = blue screen if ON. But to say that it overrules the
    client setting....No way....
    We have had every single server EVER setup with Netware with
    filecaching OFF and OpLocks2 off and changing the client side setting
    DO make a direct difference, mostly bad but in the case of Win7, file
    caching on seems to be a requirement since Win7 can't handle any open
    files in a good way withouth it. It simply states "file not found" if
    file caching = off. If file caching = on, then the client will receive
    the message that the file is busy and can be opened in read-only.
    And, again, have file caching = on AND changing the server also to ON
    is NOT a good idea, at least not for us, since we got blue screens all
    over within a couple of min's when testing that setting and those
    disapperad just a fast when setting it to off again on the server.
    On Wed, 10 Mar 2010 07:04:55 GMT, PetervdM
    <[email protected]> wrote:
    >maybe not necessary.
    >the client side setting of the file caching setting is overruled by the
    >server side setting: if the server setting is set to OFF, the client
    >will NOT cache files residing on THAT server.
    >the same holds for the file commit setting. if it is set to OFF on the
    >server, the setting on the client side will be irrelevant, it has to be
    >ON on both sides to work.
    >so i've set all servers file caching off, and file commit on, and all W7
    >clients file caching on, and file commit on.
    >
    >no pain here!
    >
    >please read anders' post dated sep 24th, 2007 for the official statement
    >from Novell:
    >http://forums.novell.com/novell-prod...le-commit.html
    >
    >
    >> You've come to the same conclusion as we have;
    >>
    >> Historicaly; File caching OFF was a MUST.
    >>
    >> With Windows 7, we find that more or less HAVE TO use file caching,
    >> despite it's problems.
    >>
    >>>
    >>> Any other suggestions?

  • Invalid File Handle - Windows 7 clients talking to Mac OS 10.5.8  server

    Hello
    I have a file-sharing volume setup under 10.5.8 server - however with the addition of Window 7 clients i'm noticing lots of error whilst trying to copy to or from that volume {setup under SMB and AFP} via a windows machine...
    My Mac OS clients report no issues
    My windows clients report the '' Invalid File Handle''
    any fixes?
    many thanks in advance!

    http://www.laurentnomine.com/2009/09/invalid-file-handle-when-copying-files-from -os-x-leopard-10-5-to-vista7/

  • (500) Internal Server Error when create storage table use development account

    Yesterday, our team suddenly cannot use storage emulator all, it always said 'can not create database' when start the emulator. Finally, we found a issue may affect this, we delete the WAStorageEmulatorDb30.mdf file in C:\Users\[User], and create manully
    in localdb, and so we can start the storage emulator later.
    But we still can not use it, since it always throw exception when creating Tables/Blobs/Queues, the exception like this:
    Microsoft.WindowsAzure.Storage.StorageException was caught
    HResult=-2146233088
    Message=The remote server returned an error: (500) Internal Server Error.
    Source=Microsoft.WindowsAzure.Storage
    StackTrace:
    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
    at Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext)
    at Microsoft.WindowsAzure.Storage.Table.CloudTable.Exists(Boolean primaryOnly, TableRequestOptions requestOptions, OperationContext operationContext)
    at Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext)
    at WorkerRole1.TableService..ctor() in c:\Users\<user>\Documents\Visual Studio 2013\Projects\WindowsAzure8\WorkerRole1\TableService.cs:line 21
    InnerException: System.Net.WebException
    HResult=-2146233079
    Message=The remote server returned an error: (500) Internal Server Error.
    Source=System
    StackTrace:
    at System.Net.HttpWebRequest.GetResponse()
    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
    InnerException:
    And if we visit this url: http://127.0.0.1:10002/devstoreaccount1, it said Internal Error:
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <code>InternalError</code>
    <message xml:lang="en-US">
    Server encountered an internal error. Please try again after some time. RequestId:e9637e04-76ad-4237-8df0-31a511e4c116 Time:2014-04-25T00:56:16.9990136Z
    </message>
    </error>
    Any ideas of this? We still don't know what caused this whole trouble from yesterday, is it possible affect the storage emulator just by code? We were coding, not configuring anything. Strange.

    I have tried it before, but not works.
    Finally, I solved this issue by delete LocalDB instance, uninstall storage emulator and install LocalDB instance / storage emulator again, it works now. Quite strange.

  • When creating keyframes on timeline, why does it sometimes add bezier handles and sometimes not?

    OK, so one of the key steps in my workflow is to do a pass of manual audio 'normalization'. Yeah, I keep getting the feeling that there might be automated tools that could do a better job, but I'm also listening for content.
    But what is driving me a little crazy right now is that sometimes, the ctrl-click adds a normal keyframe and other times, it adds a control handle for a bezier curve. This is especially frequent when doing speed ramps, but it's just so inconsistent that it drives me nuts.
    I am working on one timeline and halfway through the sequence, it comes to a clip where it ALWAYS adds bezier curves. And when I try to drag the keyframe down, it grabs the bezier handle instead, creating this bizarre S curve.
    I just don't know what I'm doing differently in that segment compared to other places. Hundreds, if not thousands of edits like this and I haven't come across a problem like this.
    Undo, and do it again causes the same thing.
    But one segment over, creating keyframes doesn't create any bezier handles.
    Production Premium CS6

    This is helpful as it explains why suddenly there are a few in a row that are bezier.
    But it doesn't explain what it is that I did to make them bezier in the first place. It just seems random. I'm just control-clicking on the timeline.
    When I get back in the office, I'll check on this a bit more carefully.

  • Error when create bid invitation (Tax code CN in procedure TAXD is invalid)

    Dear All ,
    We have issue in our PDP scenario, when creating a bid invitation from a PR (from R/3), an error occured with message" Tax code CN in procedure TAXD is invalid".
    I already raise an oss message and the reply is because the system take different company code that's not active in R/3 system. Its because TAXD procedure is assign to country DE (German) and company 0001 country is "DE".
    BE_STGE_LOC 9114
    BE_PLANT 7008
    BE_BATCH
    BE_VAL_TYPE
    BE_MOVE_REAS 0000
    BE_EXPERYDATE
    BE_PUR_GROUP
    BE_PUR_ORG
    BE_CO_CODE 0001 --> supposed the Correct company code is "8008"
    CALL FUNCTION 'FI_COMPANY_CODE_DATA'
    EXPORTING
    I_BUKRS = BUCHUNGSKREIS
    IMPORTING
    E_T001 = T001.
    We wonder how the system assign company code 0001 with plant 7008, since in R/3 Plant 7008 is assign to company code 8008.
    The company code 0001 is not active in our R/3 system.
    And also its not happen for all document , so just for several document, and not just in this plant (7008).
    The OSS reply also mention that the company chages is because this badi
    implementation ZBBP_DOC_CHANGE_BADI with object type 'BUS2121' method 'BBP_SC_CHANGE' 'Method for Changing Shopping Carts'
    ======================================================
    Assign the appropriate company code and modify the ET_ITEM table
    ls_item-be_co_code = ls_locmap-company_code.
        MODIFY et_item FROM ls_item.
    ======================================================
    But we already use this badi for several years, and we're not sure that this badi id the root cause,and until now there still no solution for this issue.
    Please kindly advise.
    Regards,
    Darwin

    Hi SG,
    In SPRO > IMG > SRM > SRM Server > Cross Application Basic Settings > Tax Calculation
    1.Determine system for tax caluclation : Choose either no tax calculation or Tax calculation occurs in back end.
    2. Enter Tax code : Mention Tax indicator as I0 and tax description Zero Tax, Check the No Tax check box and make it default based on your requirement.
    Please follow the above steps based on your requirement which will definitely resolve your issue.
    This issue comes when the tax calculation happens in the SRM system and the tax code I0 is not defined in tax procedure TAXD.
    Hope this makes you more clear. Clarifications are welcome.
    Award points for helpful answers.
    Rgds,
    Teja

  • Error when creating Production Orders: -5002 Invalid Code  [OWOR.Status]

    When creating Production Orders, I receive the error: -5002 Invalid Code  [OWOR.Status] on certain of the entries. Typically 200 orders are created at once.
    What could be causing the error?

    You may check this thread to have a reference:
    Setting the repByIns to Null
    Thanks,
    Gordon

  • Invalid SRS when create a map tile layer

    Hi,
    When i created a map tile layer and submit , it shows “Error creating a new map tile layer: Invalid SRS(spatial referencing system). This might be caused by invalid SRID or no database connection being available to retrieve SRS information.”
    And I can't view the map tile which I've created before, it alerts "Cannot get map cache instance config information for MVDEMO.DEMO_MAP. Server response: {1}.
    Thanks for any assistance.
    a-Li

    Are you trying to create a new map tile layer for the MVDEMO sample data set? If that's what you are trying to do, then may I suggest you re-download the latest MapViewer kit (10.1.3.3 for WebLogic, works on any 10g OracleAS and standalone OC4J as well), it includes a refreshed MVDEMO data set, and the best part is it already has the MVDEMO.DEMO_MAP map tile layer created for you (if you follow all the instructions come with the demo data set).
    If you still want to create a new map tile layer, then can you please post the exact parameters you entered when creating the new tile layer? Since the MVDEMO data set has a built-in SRID of 8307 (if I remember correctly), you can always use the same SRID (8307) for your tile layer.
    thanks

  • "Invalid menu handle" pops up when I try to open download files

    When I try to open down loaded files "Invalid menu handle" pops up and I can't open the files. thankyou

    Latest update. Chatted with Adobe TS. Here's their guidance (which worked for me)
    Navigate to C:\Program Files\Adobe\Adobe Photoshop CC 2014
    Rename the sniffer application as snifferold
    Relaunch Photoshop CC 2014
    The explanation was to do with having old video drivers installed )which I don't). I also don't know if no longer having a sniffer program is important. But for now, Photoshop is up and running again.

Maybe you are looking for

  • HT4437 can video from ipad be played to sony hdtv without using apple tv?

    Can video be played from ipad to sony hdtv without using apple tv

  • Outlook 2011 Search Problem

    After recently upgrading to OSX 10.9.3 my outlook 2011 search funcion only seraches the last 2 weeks of emails. Does anyone have a solution to this problem

  • Apparent bios bug when there is no video card

    I have a system that shouldn't use a video card. I have tested several KT4V and they all hang when there is no video card, even though the bios is set to "Primary Display: Absent". Any suggestions of a workaround will be highly appreciated. Thanks

  • JBOD to RAID 10 - ORLM question

    i have a 2 disk JBOD that i would like to migrate to a RAID 10. ORLM (Online Raid Level Migration) permits this, even under I/O load. But the manual that came with my controller, has me confused. First the text, then my question; +If you want to migr

  • List report page number

    Hi frnds,     I want to display page numbers as x/y,     x->current page number of list report     y->total pagenumber of list report       in header part of list report, this value has to be printed in each page of the list report.i can calculate cu