DB- stat() always return DB_LOCK_DEADLOCK, why?

HI,
when I run the test program below(windows or linux) concurrently, only the last launched process instance running properly, the previous instances always failed when executing db.stat(0), a bsddb.db.DBLockDeadlockError exception throwed.
why db_stat(0) can not recover when a DBLockDeadlockError occurred? how i can do? pls help me, thanks.
this only occurred when using hash mode, btree mode always running successfully.
#!/usr/bin/python2.5
import sys, os
from bsddb import db as bdb
import time
def open_db(home, dbtype):
  envflags = bdb.DB_INIT_TXN | bdb.DB_CREATE | bdb.DB_THREAD | \
      bdb.DB_INIT_LOCK | bdb.DB_INIT_MPOOL | bdb.DB_SYSTEM_MEM
  env = bdb.DBEnv()
  env.set_lk_detect(bdb.DB_LOCK_MINWRITE)
  env.open(home, envflags, 0)
  print 'init env ok ...'
  db = bdb.DB(env)
  db.open('test.db', dbtype=dbtype, flags=bdb.DB_CREATE)
  print 'init db ok ...'
  return env, db
def test_bdb(env, db):
  import random, time
  MAX_NUM = 30000
  get_key = lambda : 'KEY_%d' % int(random.random() * MAX_NUM)
  while True:
    try:
      db.put(get_key(), 'VALUE_%f' % random.random())
      print db.get(get_key())
      #st = db.stat(bdb.DB_FAST_STAT)
      # bsddb.db.DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock')
      # when another process launched, always throws this exception, util the post running process terminated
      st = db.stat(0)
      print 'size = %d' % st['ndata']
    except Exception, ex:
      print 'error:%s' % str(ex)
      time.sleep(0.2)
def main():
  dbhome = "dbhome"
  dbtype = bdb.DB_HASH  # hash mode, only one instance can execute db.stat(0) successfully
  # dbtype = bdb.DB_BTREE   # btree always ok
  env, db = open_db(dbhome, dbtype)
  test_bdb(env, db)
  db.close()
  env.close()
if __name__ == '__main__':
  main()Edited by: 903138 on 2011-12-19 上午2:23

Hello,
How is the program handling deadlock? The DB_LOCK_DEADLOCK
error error indicates that there is a deadlock and the thread
of control receiving the DB_LOCK_DEADLOCK error was selected
to discard its locks in order to resolve the problem. When
the application receives a DB_LOCK_DEADLOCK return, the correct
action is to close any cursors involved in the operation and abort any
enclosing transaction. A common course of action is attempt the
transaction again. Is the application currently handling
deadlocks in this way?
Thank you,
Sandra

Similar Messages

  • Passive Sentences always returns 0 in Readability Stats - Word 2013

    Is there are workaround for the Passive sentences issue in Readability stats? I have seen this issue mentioned going back over several years, but no working answer. The following code always returns zero, but grammar checker does not:
    Sub Stats()
        Dim Stats As String 
        For Each rs In ActiveDocument.Content.ReadabilityStatistics
            Stats = Stats + rs.Name & " - " & rs.Value & vbCr
        Next rs
        MsgBox Stats, vbOKOnly, "Readability Statistics"
        Stats = ""
    End Sub
    If there is no fix in Word, does anyone know of a good third party option? We would like to have statistics in a comment on a paragraph by paragraph level.
    Thanks,
    Marc Wiener
    Gartner, Inc.
    Marc Wiener

    Hi Marc,
    Base on my test in word 2013 and 2010, I can reproduce that issue too, others work fine except passive sentences.
    On the other hand, I don't find third party option.
    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.
    Regards
    Starain
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Why is it that the calendar colour always returns to purple when I have changed it to green

    why is it that the calendar colour always returns to purple when I have changed it to green

    Create a new profile as a test to check if your current profile is causing the problems.
    See "Basic Troubleshooting: Make a new profile":
    *https://support.mozilla.com/kb/Basic+Troubleshooting#w_8-make-a-new-profile
    There may be extensions and plugins installed by default in a new profile, so check that in "Tools > Add-ons > Extensions & Plugins" in case there are still problems.
    If that new profile works then you can transfer some files from the old profile to that new profile, but be careful not to copy corrupted files.
    See:
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • Why my vector() always always return the last record?

    Whenever i uses Vector, my whole vector always return the last element.. why?? Anyway to solve this?
    some examples of my codes..
    (String)rowVector.elementAt(2)
    My rowVector vector always return the last element..
    while(rs1.next())
    Vector rowVector = new Vector();
    for (int currentCol = 0; currentCol < numCols; currentCol++)
    rowVector.add(rs1.getString (currentCol + 1));
    tableData.addElement(rowVector);

    That means that every element in the Vector refers to the same object. I am surprised that your JDBC driver does not return different string objects for each call, but to work around that, try this:
    rowVector.add(new String(rs1.getString (currentCol + 1)));

  • Why buildODataEntryRequestBody always return an empty body

    We are developing a demo project to create a new travel expense report through SMP 3.0 iOS SDK. The call to get a trip detail works. Then we use the schema to build the post body for creation.
    For unknown reason, the buildODataEntryRequestBody call always returns an empty body. Could somebody help on this issue?
    Thanks.

    Its a little abstruse, don't you think?
    Assuming you are using Jdev11g, and Faces;
    I don't think there are any default 'double-click listeners' ; so that would mean, you are using client listener for dbclick event. If yes where and how are you calling your getSelectedRowKeys method?
    Julian.

  • Field Number(19,8) always returns Zero!

    Thanks for reading this
    I am developing an application in VB6 on
    NT 4 SP5 and have come accross a very strange
    error. This project is a migration from
    Sequel Server, I am redoing an ACCESS application.
    In one of the tables, the Latitude and Longitude is stored as of Type Number(19,8)
    (don't ask why - I didn't design the tables).
    All of the data is being retrieved through disconnected ADO recordsets. The data is being written with ADO connection SQL statements.
    Writing of the values through the Oracle ODBC driver seems to work properly (8.01.05 - 02/02/99). When I read the values through a ADO Recordset query, the latitude and longitude always returns 0 (when they are not null).
    I tried switching to the Microsoft ODBC Driver for Oracle, and that driver works fine. The latitude and longitude are correct.
    I can view the data fine through SQL Plus or
    ACCESS via linked Tables, so the data is OK.
    Thanks
    John
    null

    And what does this have to do with JDBC?
    There was a bug in one of the earlier 8.x Oracle ODBC drivers that woukld cause this behavior. Get the latest patch version of the driver frorm Oracle support and you will be fine.

  • HasEventListener and willTrigger always return true

    Hi  everybody.
    I'm trying to achieve the following result.
    I'm listing all items in a form.
    When I encounter a button I check if it has already an event listener applied to it. If not , I apply the event Listener with addEventListener.
    In this way, the next time I'll list the whole form I won't apply the event listener another time (if for example I apply the same event listener twice to a button which insert a new record in a database as result I'll have 2 records added also if the user clicked once...no good at all!!!)
    To accomplish this task I'm using the Actionscript function hasEventListener(EventType) and here comes the weird thing.
    Eveytime I invoke hasEventListener on the form's button it always returns true event if is the first time a list the form (so no event listener applied yet) , even if before to invoke hasEventListener I run removeEventListener.
    I've got the same behavior when i use willTrigger() function, it always returns true no matter when i call it.
    One possible solution could be set a global boolean property to store if Ialready listed the form and applied the event listener to it, but it would be better using hasEventListener, because I've got a class that perform this form listing , and this class is used on wide project, so if I get to fix this problem inside the class I would fix the problem in the entire project in on shot (I love oop programming!!!!)
    Has anybody already addressed this problem?
    Any advisement would be really appreciated.
    Thanks in advance for the attention.
    Best regards!!
    Luke

    Hi, flex harUI.
    Thanks very much for your reply.
    I knew that if I apply an event listener twice it should fire up only once, but this isn't what happen.
    Here's my scenario:
    -  I've got a component with the form inside it
    - Through a menu a go to the state the component is in and I call an "init" function inside the component
    - In the init function I call the Class which activate the form by applying eventlistener on the button
    - The user can navigate away from the component by click another menu item and then return to the component invoking again the form activation (and so let my application apply once again the addEventListener)
    - Here's what happen: the second,third,... time the user return to the component, when he try - for example - to add a record, the record is added two,three... times according to how many times the users "reinitialized" the component. The same things happen when the user tries to delete a record, he is prompted two,three,.... times if he's sure to delete it.....
    It's a really strange behaviour.
    I've found i worked around, by setting a global bool var "initialized" and before call the form activation i check the value of this var, but It's not a very beautiful solution, 'cause I would prefer to fix this problem inside the class, so the fix the problem in the whole project just in one shot!!! (that's why I would like to use hasEventListener() to check if the button has already an eventListener)
    Thaks anyway for the reply!
    If I've some news I'll update ya.
    Bye!

  • Request.getParameter() always returns null

    I have a html file and am trying to retrieve the values from a formin my servlet.
    here is the html code:
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <h1><b>Add DVD</b></h1>
    </head>
    <body>
    <form action="add_dvd.do" method="POST">
    Title:<input type="text" name="title" />
    Year:<input type="text" name="year" />
    Genre: <select name='gselected'>
    <option value='Sci-Fi'>Sci-Fi</option>
    </select>
    or enter new genre:<input type="text" name='gentered' value="" />
    <input type="submit" value="Add DVD" />
    </form>
    </body>
    </html>
    and here is the servlet code:
    public class AddDVDServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    // System.out.println("in AddDVDServlet post method");
    List errorMsgs = new LinkedList();
    //retrieve form parameters
    try{
    String title = request.getParameter("title").trim();
    String year = request.getParameter("year").trim();
    *String gentered = request.getParameter("gentered");
    String gselected = request.getParameter("gselected");
    String genre="";
    if("".equals(gentered))
    genre = gselected;
    else
    genre = gentered;
    // System.out.println("parameter retrieved");
    if(!year.matches("\\d\\d\\d\\d"))
    // System.out.println("year not 4 digit long");
    errorMsgs.add("Year must be four digit long");
    if("".equals(title))
    // System.out.println("title not entered");
    errorMsgs.add("Please enter the title of the dvd");
    if("".equals(genre))
    // System.out.println("genre not valid");zdf
    errorMsgs.add("Enter genre.");
    if(! errorMsgs.isEmpty())
    //System.out.println("errors in entry ");
    request.setAttribute("errors",errorMsgs);
    // System.out.println("error attribute set in request");
    RequestDispatcher rd = request.getRequestDispatcher("error.view");
    rd.forward(request, response);
    return;
    //create DVDItem instance
    DVDItem dvd = new DVDItem(title,year,genre);
    request.setAttribute("dvdItem",dvd);
    RequestDispatcher rd = request.getRequestDispatcher("success.view");
    rd.forward(request, response);
    catch(Exception e){
    errorMsgs.add(e.getMessage());
    request.setAttribute("errors",errorMsgs);
    RequestDispatcher rd = request.getRequestDispatcher("error.view");
    rd.forward(request, response);
    e.printStackTrace();
    System.out.println("exception:"+e);
    why does getParameter always return null??? whats wrong?

    I don't know. However, I suspect that because you have a tag with the same name as 'title', its causing a name conflict. Chnage the name to something else. If it works, then that's the likely explaination.

  • ORA-17125: "Improper statement type returned by explicit cache"

    I have been using SQLJ to some extent in the current java project but just now I'm getting this error on a particular piece of code which was converted using SQLJ pre-compiler:
    // #sql [xtrConnectionContext] { CALL
    // XTR_CFNG_DBAPI.pRemoveXTRLotsLogger(:billCycle,
    // :billCycleEndDate, :runType) };
         // declare temps
         oracle.jdbc.OraclePreparedStatement __sJT_st = null;
         sqlj.runtime.ref.DefaultContext __sJT_cc = xtrConnectionContext;
         if (__sJT_cc == null)
              sqlj.runtime.error.RuntimeRefErrors.raise_NULL_CONN_CTX();
         sqlj.runtime.ExecutionContext.OracleContext __sJT_ec = ((__sJT_cc
                   .getExecutionContext() == null) ? sqlj.runtime.ExecutionContext
                   .raiseNullExecCtx()
                   : __sJT_cc.getExecutionContext().getOracleContext());
         try {
              __sJT_st = __sJT_ec
                        .prepareOracleStatement(__sJT_cc,
                                  "0com.pt.vodafone.xtr_ppb.XTR",
                                  "BEGIN XTR_CFNG_DBAPI.pRemoveXTRLotsLogger( :1 , :2 , :3 ) \n; END;");
              // set IN parameters
              __sJT_st.setString(1, billCycle);
              __sJT_st.setString(2, billCycleEndDate);
              __sJT_st.setString(3, runType);
              // execute statement
              __sJT_ec.oracleExecuteUpdate();
         } finally {
              __sJT_ec.oracleClose();
    The procedure called has the following declaration:
    PROCEDURE pRemoveXTRLotsLogger(pvBillCycle IN VARCHAR2,
    pvBillCycleEndDate IN VARCHAR2,
    pvExpeditionCode IN VARCHAR2);
    The procedure just deletes a few records from a table and works perfectly during testing.
    The variables billCycle, billCycleEndDate, runType are all String.
    During execution, the ORA-17125 is always returned. It's description is "Improper statement type returned by explicit cache".
    One interesting thing was that even replacing the procedure call by the delete itself, the execution also returned the same error.
    I'm not using any kind of explicit cache and the connection to the database shouldn't be a problem, because previous statements in the same connection were executed without any problem.
    Thanks a for your time.
    Best regards,
    VP

    I solved the problem disabling the statement cache in my connection method:
    public DefaultContext connectToDB(String server, String port, String sid, String user, String pass) throws ErrorException {
         DefaultContext connectionContext;
         // DISABLE CONNECTION STATEMENT CACHE!
         DefaultContext.setDefaultStmtCacheSize(0);
         try {
              connectionContext = Oracle.getConnection(oracleJDBCDriver + server
                        + ":" + port + ":" + sid, user, pass, false);
         } catch (SQLException e) {
              throw new ErrorException("Connect to " + sid + " failed.");
         return (connectionContext);
    Best regards,
    VP

  • Execute oracle stored procedure from C# always returns null

    Hi,
    I'm trying to execute a stored procedure on oracle 9i. I'm using .Net OracleClient provider.
    Apparently, I can execute the stored procedure, but it always returns null as a result (actually all the sp's I have there returns null)! I can execute any text statement against the database successfully, and also I can execute the stored procedure using Toad.
    This is not the first time for me to call an oracle stored procedure, but this really is giving me a hard time! Can anyone help please?
    Below are the SP, and the code used from .Net to call it, if that can help.
    Oracle SP:
    CREATE OR REPLACE PROCEDURE APIECARE.CHECK_EXISTENCE(l_number IN NUMBER) AS
    v_status VARCHAR2(5) := NULL;
    BEGIN
    BEGIN
    SELECT CHECK_NO_EXISTENCE(to_char(l_number))
    INTO v_status
    FROM DUAL;
    EXCEPTION WHEN OTHERS THEN
    v_status := NULL;
    END;
    DBMS_OUTPUT.PUT_LINE(v_status);
    END CHECK_CONTRNO_EXISTENCE;
    C# Code:
    string connStr = "Data Source=datasource;Persist Security Info=True;User ID=user;Password=pass;Unicode=True";
    OracleConnection conn = new OracleConnection(connStr);
    OracleParameter param1 = new OracleParameter();
    param1.ParameterName = "v_status";
    param1.OracleType = OracleType.VarChar;
    param1.Size = 5;
    param1.Direction = ParameterDirection.Input;
    OracleParameter param2 = new OracleParameter();
    param2.ParameterName = "l_number";
    param2.OracleType = OracleType.Number;
    param2.Direction = ParameterDirection.Input;
    param2.Value = 006550249;
    OracleParameter[] oraParams = new OracleParameter[] { param1, param2 };
    OracleCommand cmd = new OracleCommand("CHECK_EXISTENCE", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddRange(oraParams);
    conn.Open();
    object result = cmd.ExecuteScalar();
    conn.Close();

    Hi,
    Does that actually execute? You're passing two parameters to a procedure that only takews 1 and get no error?
    Your stored procedure doesnt return anything and has no output parameters, what are you expecting to be returned exactly?
    If you're trying to access V_STATUS you'll need to declare that as either an output parameter of the procedure, or return value of the function, and also access it via accessing Param.Value, not as the result of ExecuteScalar.
    See if this helps.
    Cheers,
    Greg
    create or replace function myfunc(myinvar in varchar2, myoutvar out varchar2) return varchar2
    is
    retval varchar2(50);
    begin
    myoutvar := myinvar;
    retval := 'the return value';
    return retval;
    end;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class odpfuncparams
         public static void Main()
          OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
          con.Open();
          OracleCommand cmd = new OracleCommand("myfunc", con);
          cmd.CommandType = CommandType.StoredProcedure;
          OracleParameter retval = new OracleParameter("retval",OracleDbType.Varchar2,50);
          retval.Direction = ParameterDirection.ReturnValue;
          cmd.Parameters.Add(retval);
          OracleParameter inval = new OracleParameter("inval",OracleDbType.Varchar2);
          inval.Direction = ParameterDirection.Input; 
          inval.Value="hello world";
          cmd.Parameters.Add(inval);
          OracleParameter outval = new OracleParameter("outval",OracleDbType.Varchar2,50);
          outval.Direction = ParameterDirection.Output;
          cmd.Parameters.Add(outval);
          cmd.ExecuteNonQuery();
          Console.WriteLine("return value is {0}, out value is {1}",retval.Value,outval.Value);
          con.Close();
    }

  • Select query on table rcv_lots_interface is always returning null

    Hi ,
    I need a help on the below issue.
    The issue is after creating PO in Oracle 11i I receive it in MSCA application.
    When we receive it at that point data gets inserted in the table " rcv_transactions_interface " and we have written a trigger on it.
    From the trigger on table " rcv_transactions_interface " we are calling a package and in the package we have select query on "rcv_lots_interface."
    But the select query is always returning null even though we are passing the correct "interface_transaction_id " and also after the "Receiving Transaction Processor" is executed i can see data in the table " RCV_LOT_TRANSACTIONS " for the same transaction.
    Below is the sample code i am using.
    CREATE OR REPLACE TRIGGER inv.RCV_TRAN_TRIGGER
    AFTER UPDATE
    ON po.rcv_transactions_interface
    FOR EACH ROW
    WHEN (NEW.processing_status_code='PENDING'
    AND NEW.destination_type_code IN ('INVENTORY','RECEIVING')
    AND NEW.mobile_txn = 'Y')
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    v_user_id NUMBER;
    v_interface_transaction_id NUMBER;
    v_organization_id NUMBER;
    v_item_id NUMBER;
    v_quantity NUMBER;
    v_resp_id NUMBER;
    v_mobile_txn VARCHAR2(5);
    v_shipment_header_id NUMBER;
    v_bill_of_lading VARCHAR2(100);
    v_group_id NUMBER;
    v_header_interface_id NUMBER;
    BEGIN
    v_interface_transaction_id := :NEW.interface_transaction_id;
    v_organization_id := :NEW.to_organization_id;
    v_user_id := :NEW.created_by;
    v_item_id := :NEW.item_id;
    v_quantity := :NEW.quantity;
    v_resp_id :=fnd_profile.VALUE('RESP_ID');
    v_transaction_type := :NEW.transaction_type;
    v_mobile_txn := :NEW.mobile_txn;
    v_bill_of_lading := :NEW.bill_of_lading;
    v_group_id := :NEW.group_id;
    v_header_interface_id := :NEW.HEADER_INTERFACE_ID;
    INV.INV_RCV_TRX_PKG.INV_RCV_LABEL_GEN_PRC( v_user_id,
    v_interface_transaction_id,
    v_item_id,
    v_quantity,
    v_organization_id,
    v_resp_id,
    v_shipment_header_id,
    v_bill_of_lading,
    v_header_interface_id,
    v_group_id);
    END;
    CREATE OR REPLACE PACKAGE BODY INV.INV_RCV_TRX_PKG
    AS
    PROCEDURE INV_RCV_LABEL_GEN_PRC( p_user_id IN NUMBER,
    p_interface_transaction_id IN NUMBER,
    p_item_id IN NUMBER,
    p_quantity IN NUMBER,
    p_organization_id IN NUMBER,
    p_resp_id IN NUMBER,
    p_shipment_header_id IN NUMBER,
    p_bill_of_lading IN VARCHAR2,
    p_header_interface_id IN NUMBER ,
    p_group_id IN NUMBER
    IS
    v_user_id NUMBER;
    v_print BOOLEAN;
    v_resp_id NUMBER;
    v_resp_appl_id NUMBER;
    v_lot_num VARCHAR2(50);
    BEGIN
    BEGIN
    SELECT application_id
    INTO v_resp_appl_id
    FROM apps.fnd_responsibility_tl frt
    WHERE responsibility_id=p_resp_id;
    END;
    apps.fnd_global.apps_initialize(p_user_id, p_resp_id, v_resp_appl_id);
    BEGIN
    SELECT rli.lot_num , rli.expiration_date
    INTO v_lot_num ,
    v_expiration_date
    FROM apps.rcv_lots_interface rli
    WHERE rli.interface_transaction_id = p_interface_transaction_id ;
    EXCEPTION
    WHEN OTHERS THEN
    v_lot_num :=NULL;
    v_expiration_date :=NULL;
    apps.fnd_file.put_line(fnd_file.log,'Exception while deriving LOT Number ######### '||p_interface_transaction_id||'------'||SQLERRM);
    END;
    END;
    Need your help to understand why the below query is always returning null and what is the solution for it ?
    SELECT rli.lot_num , rli.expiration_date
    FROM apps.rcv_lots_interface rli
    WHERE rli.interface_transaction_id = p_interface_transaction_id ;
    Thanks
    Jaydeep
    Edited by: user10454886 on Mar 25, 2013 6:31 AM
    Hi ,
    I need a solution to this issue at the earliest.
    Appreciate all of your help
    Thanks
    Jaydeep

    Centinul wrote:
    There are a lot of bugs listed in Metalink with respect to wrong results and function-based indexes.
    Here are a few:
    Bug 4028186 Wrong results if function based index exists
    Bug 4717546 Wrong results / poor plan when function based index exists
    Bug 5092688 Wrong results if function based index exists
    Based on reviewing them the workarounds range from dropping the index to setting "_disable_function_based_index" to TRUE.Facinating. It seems to me that if you use the undocumented intitialization parameter you might just as well drop the FBIs too.
    Another hazard of FBIs is the Law of Unintended Consequences. 2 years ago we tried to use one to speed up a query in a PL/SQL package. Worked OK for that purpose, but an unrelated loader on the affected table ran and rand but never finished until the FBI was dropped.

  • Output parameters always return null when ExecuteNonQuery - No RefCursor

    I am trying to call a procedure through ODP that passes in one input parameter and returns two (non-RefCursor) VARCHAR2 output parameters. I am calling the procedure using ExecuteNonQuery(); however, my parameters always return null. When I run the procedure outside of ODP, such as with SQLPlus or SQL Navigator, the output parameters are populated correctly. For some reason, there appears to be a disconnect inside of ODP. Is there a way to resolve this?
    Anyone have this problem?
    Here is the basic code:
    ===========================================================
    //     External call of the class below
    DBNonCursorParameterTest Tester = new DBNonCursorParameterTest();
    ===========================================================
    //     The class and constructor that calls the procedure and prints the results.
    public class DBNonCursorParameterTest
         public DBNonCursorParameterTest()
              //     The test procedure I used is a procedure that takes a recordID (Int32) and then returns a
              //     general Name (Varchar2) and a Legal Name (Varchar2) from one table with those three fields.
              string strProcName                    = "MyTestProc;
              OracleConnection conn               = new OracleConnection(DBConnection.ConnectionString);
              OracleCommand cmd                    = new OracleCommand(strProcName,conn);
              cmd.CommandType                         = CommandType.StoredProcedure;
                   //     Create the input parameter and the output cursor parameter to retrieve data; assign a value to the input parameter;
              //     then create the parameter collection and add the parameters.
              OracleParameter pBPID               = new OracleParameter("p_bpid",               OracleDbType.Int32,          ParameterDirection.Input);
              OracleParameter pBPName               = new OracleParameter("p_Name",               OracleDbType.Varchar2,     ParameterDirection.Output);
              OracleParameter pBPLegalName     = new OracleParameter("p_LegalName",     OracleDbType.Varchar2,     ParameterDirection.Output);
              pBPID.Value = 1;
              //     Open connection and run stored procedure.
              try
                   conn.Open();
                   cmd.Parameters.Add(pBPID);
                   cmd.Parameters.Add(pBPName);
                   cmd.Parameters.Add(pBPLegalName);
                   cmd.ExecuteNonQuery();
                   Console.Write("\n" + cmd.CommandText + "\n\n");
                   //for (int i = 0; i < cmd.Parameters.Count; i++)
                   // Console.WriteLine("Parameter: " + cmd.Parameters.ParameterName + " Direction = "     + cmd.Parameters[i].Direction.ToString());
                   // Console.WriteLine("Parameter: " + cmd.Parameters[i].ParameterName + " Status = "          + cmd.Parameters[i].Status.ToString());
                   // Console.WriteLine("Parameter: " + cmd.Parameters[i].ParameterName + " Value = "          + cmd.Parameters[i].Value.ToString() + "\n");
                   foreach (OracleParameter orap in cmd.Parameters)
                        Console.WriteLine("Parameter: " + orap.ParameterName + " Direction = "     + orap.Direction.ToString() + " Value = " + orap.Value.ToString());
                        Console.WriteLine("Parameter: " + orap.ParameterName + " Status = "          + orap.Status.ToString());
                        Console.WriteLine("Parameter: " + orap.ParameterName + " Value = "          + orap.Value.ToString() + "\n");
                   //     End Test code.
              catch (Exception ex)
                   throw new Exception("ExecuteQuery() failed: " + ex.Message);
              finally
                   this.Close();
         public void Close()
              if (conn.State != ConnectionState.Closed)
                   conn.Close();
    =========================================================
    Other things to note:
    I have no problems with returning RefCursors; they work fine. I just don't want to use RefCursors when they are not efficient, and I want to have the ability to return output parameters when I only want to return single values and/or a value from an insert/update/delete.
    Thanks for any help you can provide.

    Hello,
    Here's a short test using multiple out parameters and a stored procedure. Does this work as expected in your environment?
    Database:
    /* simple procedure to return multiple out parameters */
    create or replace procedure out_test (p_text in varchar2,
                                          p_upper out varchar2,
                                          p_initcap out varchar2)
    as
    begin
      select upper(p_text) into p_upper from dual;
      select initcap(p_text) into p_initcap from dual;
    end;
    /C# source:
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    namespace Miscellaneous
      class Program
        static void Main(string[] args)
          // change connection string as appropriate
          const string constr = "User Id=orademo; " +
                                "Password=oracle; " +
                                "Data Source=orademo; " +
                                "Enlist=false; " +
                                "Pooling=false";
          // the stored procedure to execute
          const string sql = "out_test";
          // simple input parameter for the stored procedure
          string text = "hello!";
          // create and open connection
          OracleConnection con = new OracleConnection(constr);
          con.Open();
          // create and setup connection object
          OracleCommand cmd = con.CreateCommand();
          cmd.CommandText = sql;
          cmd.CommandType = CommandType.StoredProcedure;
          // the input paramater
          OracleParameter p_text = new OracleParameter("p_text",
                                                       OracleDbType.Varchar2,
                                                       text.Length,
                                                       text,
                                                       ParameterDirection.Input);
          // first output parameter
          OracleParameter p_upper = new OracleParameter("p_upper",
                                                        OracleDbType.Varchar2,
                                                        text.Length,
                                                        null,
                                                        ParameterDirection.Output);
          // second output parameter
          OracleParameter p_initcap = new OracleParameter("p_initcap",
                                                          OracleDbType.Varchar2,
                                                          text.Length,
                                                          null,
                                                          ParameterDirection.Output);
          // add parameters to collection
          cmd.Parameters.Add(p_text);
          cmd.Parameters.Add(p_upper);
          cmd.Parameters.Add(p_initcap);
          // execute the stored procedure
          cmd.ExecuteNonQuery();
          // write results to console
          Console.WriteLine("   p_text = {0}", text);
          Console.WriteLine("  p_upper = {0}", p_upper.Value.ToString());
          Console.WriteLine("p_initcap = {0}", p_initcap.Value.ToString());
          Console.WriteLine();
          // keep console from closing when run in debug mode from IDE
          Console.WriteLine("ENTER to continue...");
          Console.ReadLine();
    }Output:
       p_text = hello!
      p_upper = HELLO!
    p_initcap = Hello!
    ENTER to continue...- Mark

  • Popularity Trends report always returns zero

    Hello,
    I have a SharePoint installed on “Windows server 2008 -R2”.
    I have a SQL Data base installed on the same machine.
    I create a new web application with port “2020”. Then I create w new site collection “Publishing”.
    I activate the feature “Reporting” in the site collection level.
    I Open central admin “Monitoring >> Configure usage and health data collection”. I checked “Enable usage data collection” Check box. And I Checked All “Events to Log” check boxes.
    I have configures the following services applications :
           -Business Connectivity Service
           -Excel Services Application
          -Search Service Application
         -Security Token Service Application
         -Application Discovery and Load Balancer Service Application
         -WSS_UsageApplication.
    I run the crawl search. And it is completed successfully.
    The search service account is member of “WSS_WPG” group.
    I have checked the following values from SharePoint PowerShell:
             AppEventTypeId          : 00000000-0000-0000-0000-000000000000
             EventTypeId                 : 1
             EventName                   : Views
             LifeTimeManagedPropertyName : ViewsLifeTime
             RecentManagedPropertyName   : ViewsRecent
            ApplicationName             :
            RecommendationWeight        : 1
           RelevanceWeight             : 1
          RecentPopularityTimeframe   : 14
          AggregationType             : Count, UniqueUsers
         Rollups                     : SiteSubscriptionId, SiteId, ScopeId
        TailTrimming                : 2
       Options                     : AllowAnonymousWrite
        IsReadOnly                  : False
    I open the “default.aspx” page on the portal (I have opened it more than 10 times in different browser window).
    Next day I open “popularity Trends” report, I found that it returns zero.
    I open the “Analytics Report” data base. Then I open “AnalyticsItemData” table. There are already items in the table.
        So I need to know why the “popularity Trends” excel sheet report returns zeros all the time.
    ASk

    Hi,
    According to your description, the popularity Trends report always returns no records.
    Please check the status of the 3 timer jobs: Microsoft SharePoint Foundation Usage Data Import, Microsoft SharePoint Foundation Usage Data Processing and Web Analytics
    Trigger Workflows to see if they are configured to run at regular intervals.
    Also you can take a look at the two links about the similar issue for more information:
    http://www.myriadtech.com.au/blog/Ben/Lists/Posts/Post.aspx?ID=7
    http://sharepoint.stackexchange.com/questions/66476/whats-popular-webpart-is-empty
    Feel free to reply if there any progress.
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • GetUsageData is always returning Null

    Let me first start out by stating that I know there are many questions on this issue, and I have read them all. However, none of the suggestions that I have read have seemed to help my situation. Therefore, I figure I would supply my code with the hopes
    that someone can solve the issue that is mentioned in the title. Let me first supply a little bit of background.
    My goal in this code is to determine what are the most visited sites in our SharePoint 2010 farm. To do this, I figured I would cycle through all of the webs in the farm, and then obtain the amount of page views within each site using the GetUsageData function.
    Just to test if the GetUsageData was supplying the correct data, I coded the web part in such a way where if GetUsageData returned "Null", it would print it for every site, and "Not Null" if otherwise. In every case I have tested this web part, it has always
    returned Null for evey site it has checked.
    I am fairly new to programming web parts in C#, so a lot of this code is derived from what I have read when researching the subject. If anyone can assist me to see where I could fix my issue, I would greatly appreciate it.
    Thank you.
    Below is my Code:
    using System;
    using System.Data;
    using System.Collections;
    using System.ComponentModel;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.SharePoint.WebControls;
    //This code has been derived from the following link: http://blog.rafelo.com/2008/07/22/iterating-through-sharepoint-web-applications-site-collections-and-sites-webs/
    namespace WebAnalyticsTest.Test
    [ToolboxItemAttribute(false)]
    public class Test : WebPart
    //For testing purposes. More is explained further in the code.
    int test;
    ArrayList totalHitsArray = new ArrayList();
    int totalHits;
    DataGrid grid = null;
    public void BeginProcess()
    // Get references to the farm and farm WebService objects
    // the SPWebService object contains the SPWebApplications
    SPFarm thisFarm = SPFarm.Local;
    SPWebService service = thisFarm.Services.GetValue<SPWebService>("");
    foreach (SPWebApplication webApp in service.WebApplications)
    //Execute any logic you need to against the web application
    //Iterate through each site collection
    foreach (SPSite siteCollection in webApp.Sites)
    //do not let SharePoint handle the access denied
    //exceptions. If one occurs you will be redirected
    //in the middle of the process. Handle the AccessDenied
    //exception yourself in a try-catch block
    siteCollection.CatchAccessDeniedException = false;
    try
    //Execute any logic you need to against the site collection
    //Call the recursive method to get all of the sites(webs)
    GetWebs(siteCollection.AllWebs);
    catch (Exception webE)
    //You should log the error for reference
    //reset the CatchAccessDeniedException property of the site
    //collection to true
    siteCollection.CatchAccessDeniedException = true;
    public void GetWebs(SPWebCollection allWebs)
    //iterate through each site(web)
    foreach (SPWeb web in allWebs)
    if(web.Exists)
    //For every site the program finds, the count will increase by one. If this code is executed by a user who does not have
    //full control, then the count will be inaccurate as it will only return the number of sites the user can access.
    test += 1;
    DataTable table = web.GetUsageData(Microsoft.SharePoint.Administration.SPUsageReportType.browser, Microsoft.SharePoint.Administration.SPUsagePeriodType.lastMonth);
    if (table == null)
    HttpContext.Current.Response.Write("Null");
    else
    HttpContext.Current.Response.Write("Not Null");
    protected override void CreateChildControls()
    BeginProcess();

    Hi, Shiladitya.
    Sorry I haven't replied until now. I'll paste the current code I am using, but my solution is not yet complete. What it does as of right now is it creates a data table with all of the webs located in your farm, as well as the total amount of page views for
    each web. What I noticed though is that when I compare these stats with the web analytics for the specific web, they don't match. I put the project on hold for this reason, and I might start it back up again soon. Feel free to use the code, and perhaps you
    maybe can shed some light on my issue.
    using System;
    using System.Data;
    using System.Collections;
    using System.ComponentModel;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.SharePoint.WebControls;
    //This code has been derived from the following link: http://blog.rafelo.com/2008/07/22/iterating-through-sharepoint-web-applications-site-collections-and-sites-webs/
    namespace WebAnalyticsTest.Test
    [ToolboxItemAttribute(false)]
    public class Test : WebPart
    //For the total amount of hits for a single web
    int totalHits;
    //The final data table that will be added to.
    DataTable final = new DataTable();
    //Size of the data table
    int finalSize = 0;
    //The grid that will be displayed
    DataGrid grid = new DataGrid();
    public void BeginProcess()
    //To allow users with lower permissions to view the proper content, the code must be used with RunWithElevatedPrivileges.
    SPSecurity.RunWithElevatedPrivileges(delegate()
    // Get references to the farm and farm WebService objects
    // the SPWebService object contains the SPWebApplications
    SPFarm thisFarm = SPFarm.Local;
    SPWebService service = thisFarm.Services.GetValue<SPWebService>("");
    foreach (SPWebApplication webApp in service.WebApplications)
    //Execute any logic you need to against the web application
    //Iterate through each site collection
    foreach (SPSite siteCollection in webApp.Sites)
    //do not let SharePoint handle the access denied
    //exceptions. If one occurs you will be redirected
    //in the middle of the process. Handle the AccessDenied
    //exception yourself in a try-catch block
    siteCollection.CatchAccessDeniedException = false;
    try
    //Execute any logic you need to against the site collection
    //Call the recursive method to get all of the sites(webs)
    GetWebs(siteCollection.AllWebs);
    catch (Exception webE)
    //Place any error logic here
    //reset the CatchAccessDeniedException property of the site
    //collection to true
    siteCollection.CatchAccessDeniedException = true;
    public void GetWebs(SPWebCollection allWebs)
    //iterate through each site(web)
    foreach (SPWeb web in allWebs)
    if (web.Exists)
    DataTable table = web.GetUsageData(SPUsageReportType.url, SPUsagePeriodType.lastMonth);
    if (table != null)
    //Determines the total amount of hits for a single web
    foreach (DataRow row in table.Rows)
    int num = System.Convert.ToInt32(row["Total Hits"]);
    totalHits = totalHits + num;
    //Temporarily stores the total hits with the associated web.
    DataTable temp = new DataTable();
    temp.Columns.Add("Site", typeof(string));
    temp.Columns.Add("Total Views", typeof(int));
    temp.Rows.Add(web.Title, totalHits);
    //Merges the data table "temp" to the data table "final"
    final.Merge(temp);
    //Data table size increases by one.
    finalSize += 1;
    //Resets the total hit counter
    totalHits = 0;
    protected override void CreateChildControls()
    BeginProcess();
    //Sorts the data table bases on the total hits
    final.DefaultView.Sort = "Total Views DESC";
    //The total amount of pages to show is 10. Therefore, only execute this If statement if the final's size > 10.
    if (finalSize > 10)
    //Data table of the top ten most viewed pages. This data table will be used in the data grid "grid"
    DataTable topTen = final.Clone();
    for (int i = 0; i < 10; i++)
    topTen.ImportRow(final.Rows[i]);
    grid.DataSource = topTen;
    else
    grid.DataSource = final;
    grid.DataBind();
    this.Controls.Add(grid);
    ListBox list = new ListBox();

  • JNI_GetCreatedJavaVMs always return zero

    Why does pfnGetCreatedJavaVMs(&jvmBuf, 1, &no_vms) always return 0(success) even though there is no created JVM?
    typedef jint (JNICALL GetCreatedJVMs_t)(JavaVM *vmBuf, jsize bufLen,jsize *nVMs);
    GetCreatedJVMs_t pfnGetCreatedJavaVMs=(GetCreatedJVMs_t)GetProcAddress(handle,"JNI_GetCreatedJavaVMs");
              JavaVM* jvmBuf=NULL;
              jsize no_vms=0;
              if(pfnGetCreatedJavaVMs(&jvmBuf, 1, &no_vms)==JNI_OK)
                   OutputDebugString("VM Found!! Trying to attach to it..");
                   jvm = &jvmBuf[0];
                   if(jvm!=NULL && no_vms!=0)
                        (*jvm).AttachCurrentThread((void **)&env, NULL);
              else{
                   OutputDebugString("Cannot find created VMs");
    /*****************************************************

    Here is sample code:
    if (m_vm == NULL){
         env->GetJavaVM(&mvm);
    jobj = env->NewGlobalRef(_jobj);
    m_vm->AttachCurrentThread((void **)&_env, NULL);
    jclass jcls = env->GetObjectClass(_jobj);
    jmethodID id = env->GetMethodID(_jcls, "OnRecvData", "(Ljava/lang/String;)V");
    jint jint = env->CallIntMethod(_jobj, id, jstr);

Maybe you are looking for

  • My bookmarks bar w/zoom in/out feature disappeared after changing display, are they gone gone?

    Out of the blue my freemake video downloader app window opened to a size so lg it covered my taskbar + the "close" button & scrollbar were extended beyond desktop. It was unuseable I had to use ctrl+alt+delete to close it. I thought malware may've cr

  • "Break out" black and pms for prepress?

    Help please? I am working in Illustrator CS4, and finished a 2-sided mailer/postcard for a client in cmyk. After emailing the final PDF to the client, the client responded back to me with their print provider's request for- "native file, with black a

  • Can I restore all my pictures on m ipad

    HHow can I restore all my pictures just deleted accidentally

  • Known networks not recognizing

    Below is a post from Mac Rumors, but it discribes my problem perfectly.  BTW: Mac Rumors did not solve the problem on the thread located here: http://forums.macrumors.com/showthread.php?t=1408213 Every time I open my MacBook Pro it requires that I se

  • Hi, want to buy some PC components !

    Hi guys. So, I have this components that i want to use on the new PC: - MSI GeForce GT240 1GB DDR5 128-bit HDMI - OCZ GameXStream 600 W ( OCZ600GXSSLI ) ( http://www.ocztechnology.com/products/power_management/ocz_gamexstream_power_supply-nvidia_sli_