Connection object is getting closed before the stored procedure is complete

Hi Everyone,
I am facing an issue where by the java connection object is closed before the stored procedure it is connected to is complete.
I am not sure if the fault is in SP or Connection pool.
After spending some time, i could able to figure out that the procedure is taking a tad more time for processing as there are over 1000 records in the database tables it is dealing with.
Would that be a potential cause ? or Am i required to handle it in Java only ?
I want to know what could be possible causes for this issue ?
Please Help.
FYI,
The following are the logs which says,
XYZ (Stored Procedure) : Start Time is 1349217771302 Procedure started here
INFO >2012-10-02 18:43:09,935 [ConnectionPool]: Closing connection: DataSource [ABC](684)
INFO >2012-10-02 18:46:03,512 DAO[main]: XYZ : End Time is 1349217963512 Procedure ended here
Thanks in Advance.

Hi ,
Thank you all for your quick response.
Well it's my bad i dint provide you any code to look into thinking that i am dealt with a gen issue and also i am too paranoid to post any code i am dealing with in the forum (i am sorry).
But here is some information for you,
Database : Oracle 10g
Java: 1.5 version
We are using only One connection object for the entire java backend process .
The SP is of over 1000 lines of code which for obvious reasons i can't past it here but this morning i figured out an issue in SP where by a query taking way more than usual time to execute which led to SP's poor performance and also the reason for why it is taking very long time than usual.
This query is a simple SELECT query where it is trying fetch over 2000 records from a table of over 3 million records. The execution time is over 30-40 seconds which is the root cause of SP's poor performance.
When i eliminated this from the logic and ran the query it could able process (inserting huge volume around 5000 records of data) in 1 second instead of 3-4 minutes earlier.
I tried to replicate this issue (which occurred in our production server) in my local system but no luck as there was no connection issue here but only the substantial time difference.
We are using a customized connection pool which is as follows,
I am not sure what's going on here because it seems to be greek and latin to me.
What we are doing in our DAO is we are using method of the below ConnectionPool.getInstance(SCHEMA) to get the connection object.
Looking forward to seeking advice from you on how connection pool in general works.
public class ConnectionPool extends Thread
     private static final ConnectionPool me = new ConnectionPool();
     private Hashtable dataSources = new Hashtable();
     private static final int MIN_TIMEOUT = 0;
     private long timeOut;
     private Hashtable cons = new Hashtable();
     private Hashtable active = new Hashtable();
    private boolean trace = false;
     private ConnectionPool()
          registerDataSources();
          this.timeOut = PropertyManager.getIntProperty("connectionPool.timeOut", MIN_TIMEOUT);
          setName("ConnectionPool");
          setPriority(MIN_PRIORITY);
          if (timeOut > 0)
               start();
     private void registerDataSources()
        dataSources.clear();
          Properties props = System.getProperties();
          String app = props.getProperty("X", "Y");
          for(Enumeration e = props.keys(); e.hasMoreElements();)
               String key = (String) e.nextElement();
               if (key.startsWith(app + ".connectionPool.dataSources.") && key.endsWith(".selector"))
                    String ds = key.substring((app + ".connectionPool.dataSources.").length(), key.length() - ".selector".length());
                    LogManager.logStatus("Registering [" + ds + "] (selector) " +
                              props.getProperty(app + ".connectionPool.dataSources." + ds + ".selector"));
                    dataSources.put(ds,
                         new GenDataSource(
                              ds,
                              props.getProperty(app + ".connectionPool.dataSources." + ds + ".selector")));
                    continue;                    
               if (!key.startsWith(app + ".connectionPool.dataSources.") || !key.endsWith(".server"))
                    continue;
               String ds = key.substring((app + ".connectionPool.dataSources.").length(), key.length() - ".server".length());
               try
                    LogManager.logStatus("Registering [" + ds + "] " +
                              props.getProperty(app + ".connectionPool.dataSources." + ds + ".url"));
                    loadDriver(props.getProperty(app + ".connectionPool.dataSources." + ds + ".driver"));
               catch (Exception se)
                    LogManager.logException(se);
               GenDataSource genDataSource = new GenDataSource(
                         ds,
                         props.getProperty(app + ".connectionPool.dataSources." + ds + ".useMatrix", "false").equals("true"),
                         props.getProperty(app + ".connectionPool.dataSources." + ds + ".server"),
                         props.getProperty(app + ".connectionPool.dataSources." + ds + ".url"),
                         props.getProperty(app + ".connectionPool.dataSources." + ds + ".user"),
                         props.getProperty(app + ".connectionPool.dataSources." + ds + ".password"));
               // Set the schema if schema is defined in settings.xml file
               if (genDataSource != null && props.getProperty(app + ".connectionPool.dataSources." + ds + ".schema") != null ) {
                    genDataSource.setSchema(props.getProperty(app + ".connectionPool.dataSources." + ds + ".schema"));
               dataSources.put(ds, genDataSource);
     public static Connection getConnection(String dataSource) throws SQLException
          GenDataSource ds = (GenDataSource) me.dataSources.get(dataSource);
          if (me.timeOut <= 0)
               if (ds.getSchema() != null )
                    return updateSchema ( ds);
               else
                    return DriverManager.getConnection(ds.url(), ds.user(), ds.password());
          String key = dataSource;
          Stack free;
          GenPooledConnection pc = null;
          synchronized (me)
               if ((free = (Stack) me.cons.get(key)) == null)
                    free = new Stack();
                    me.cons.put(key, free);
               if (!free.empty())
                    pc = (GenPooledConnection) free.pop();
               if (pc == null)
                    if (ds.getSchema() != null )
                         pc = new GenPooledConnection("DataSource [" + key + "]",
                                             updateSchema ( ds), free, me.active, me.timeOut, me.trace);
                    else
                         pc = new GenPooledConnection("DataSource [" + key + "]",
                                   DriverManager.getConnection(ds.url(), ds.user(), ds.password()), free, me.active, me.timeOut, me.trace);
               else
                    pc.touch();
          LogManager.logStatus("Using " + pc);
          me.active.put(pc.id(), pc);
          return pc;
     public void run()
          for(;;)
               try
                    sleep(60 * 1000);
                    synchronized (me) {
                         for(Enumeration e = cons.elements(); e.hasMoreElements();)
                              Stack stack = (Stack) e.nextElement();
                              for (int i = stack.size()-1; i >= 0; i--)
                                   GenPooledConnection pc = (GenPooledConnection) stack.elementAt(i);
                                   if (pc.isExpired())
                                        stack.removeElementAt(i);
               catch (Exception e)
                    GenUtil.reportException(e);
     private static Connection updateSchema ( GenDataSource ds) throws SQLException {
          Connection con = DriverManager.getConnection(ds.url(), ds.user(), ds.password());
          if (ds.getSchema() != null ) {
               String sql = "SET SCHEMA  " + ds.getSchema()+ ";";
               LogManager.logDebugMessage("updating the Schema with sql statement " + sql);
               PreparedStatement ps = con.prepareStatement(sql);
               ps.execute();
               ps.close();
          return con;
}Thanks.
Edited by: EJP on 5/10/2012 14:09: added {noformat}{noformat} tags. Please use them.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Executing the stored procedure with output which is a collection of objects

    Hello,
    I have the objects and collection of objects within an objects as below:
    CREATE OR REPLACE TYPE SHARE_OUTST_T
    AS OBJECT
    SHR_OUTST_AMT     number
    CREATE OR REPLACE TYPE SECURITY_T
    AS OBJECT
         VOTE_PER_SHR     number
    , CUSIP     varchar2(12)
    , EXCHANGE     varchar2(10)
    , IV_TYPE_CD     varchar2(10)
    , SEC_TICKER_SYMB     varchar2(20)
    CREATE OR REPLACE TYPE ALTERNATE_ID_T
    AS OBJECT
    ( ALT_ID_TYPE     varchar2(20)
    CREATE OR REPLACE TYPE ISSUE_MAINT_VERSION_T
    AS OBJECT
         IM_KEY_ID number     
    ,     IM_VER_NUM number
    ,     EFF_TMSTMP timestamp
    , EXP_TMSTMP timestamp
    ,     NEXT_REVIEW_TMSTMP timestamp
    ,     APPR_STATUS_REF_ID number
    , VOTE number
    , ADD_USR_ID varchar2(20)
    , ADD_TMSTMP timestamp
    , UPD_USR_ID varchar2(20)
    , UPD_TMSTMP timestamp
    , LOCK_LEVEL_NUM number
    , ACTION VARCHAR2(1)
    CREATE OR REPLACE TYPE ISSUE_SHARE_MAINT_T
    AS OBJECT
         IM_KEY_ID      number     
    ,     IM_VER_NUM      number
    ,     SHR_OUTST_AMT      number
    ,     CURR_OUTST_AMT     number
    ,      ADD_USR_ID      varchar2(20)
    ,      ADD_TMSTMP      timestamp
    ,      UPD_USR_ID      varchar2(20)
    ,      UPD_TMSTMP      timestamp
    ,      LOCK_LEVEL_NUM      number
    ,     ACTION     VARCHAR2(1)
    CREATE OR REPLACE TYPE ISSUE_MAINT_COMMENT_T
    AS OBJECT
         IM_KEY_ID      number     
    ,     IM_VER_NUM      number
    ,     COMMENT_TXT     varchar2(400)
    ,      ADD_USR_ID      varchar2(20)
    ,      ADD_TMSTMP      timestamp
    ,      UPD_USR_ID      varchar2(20)
    ,      UPD_TMSTMP      timestamp
    ,      LOCK_LEVEL_NUM      number
    ,     ACTION     VARCHAR2(1)
    CREATE OR REPLACE TYPE ISSUE_MAINT_COMMENT_COL_T AS TABLE OF ISSUE_MAINT_COMMENT_T;
    CREATE OR REPLACE TYPE ISSUE_VERSION_T
    AS OBJECT
         SHARE_OUTST     SHARE_OUTST_T
    ,     SECURITY     SECURITY_T
    ,     ALTERNATE_ID     ALTERNATE_ID_T
    ,     ISSUER     ISSUER_T
    ,     ISSUE_MAINT_VERSION     ISSUE_MAINT_VERSION_T
    ,     ISSUE_SHARE_MAINT     ISSUE_SHARE_MAINT_T
    , ISSUE_MAINT_COMMENT_COL ISSUE_MAINT_COMMENT_T
    CREATE OR REPLACE TYPE ISSUE_VERSION_COL_T AS TABLE OF ISSUE_VERSION_T;
    And the stored procedure as :
    =======================================
    PROCEDURE get_all_issue_version_col
    ( pv_issue_version_col OUT issue_version_col_t
    AS
    CURSOR cur_issue_version
    IS
    SELECT
    issue_version_t (
    SHARE_OUTST_T (so.shr_outst_amt )
    , SECURITY_T ( s.vote_per_shr
    , s.sec_cusip
    , s.PRI_MKT_EXCH_CD
    , s.IV_TYPE_CD
    , s.SEC_TICKER_SYMB )
    , ALTERNATE_ID_T (a.ALT_ID_TYPE)
    , ISSUER_T (i.ISSR_ID )
    , ISSUE_MAINT_VERSION_T (imv.im_key_id
    , imv.im_ver_num
    , imv.eff_tmstmp
    , imv.exp_tmstmp
    , imv.next_review_tmstmp
    , imv.appr_status_ref_id
    , imv.vote
    , imv.add_usr_id
    , imv.add_tmstmp
    , imv.upd_usr_id
    , imv.upd_tmstmp
    , imv.lock_level_num
    , NULL )
    , ISSUE_SHARE_MAINT_T (ism.im_key_id
    , ism.im_ver_num
    , ism.shr_outst_amt
    , ism.curr_outst_amt
    , ism.add_usr_id
    , ism.add_tmstmp
    , ism.upd_usr_id
    , ism.upd_tmstmp
    , ism.lock_level_num
    , NULL)
    , ISSUE_MAINT_COMMENT_T(imc.im_key_id
    , imc.im_ver_num
    , imc.comment_txt
    , imc.add_usr_id
    , imc.add_tmstmp
    , imc.upd_usr_id
    , imc.upd_tmstmp
    , imc.lock_level_num
    , NULL )
    FROM
    share_outst so
    , security s
    , alternate_id a
    , issuer i
    , issue_maintenance_version imv
    , issue_share_maintenance ism
    , issue_maintenance_comment imc
    WHERE
    s.sec_key_id = so.SEC_KEY_ID
    and s.SEC_KEY_ID = a.SEC_KEY_ID
    and s.MSTR_ISSR_KEY_ID = i.ISSR_KEY_ID
    and s.SEC_CUSIP = imv.SEC_CUSIP (+)
    and s.SEC_CUSIP = ism.SEC_CUSIP (+)
    and imv.IM_KEY_ID = imc.IM_KEY_ID (+);
    BEGIN
    OPEN cur_issue_version ;
    FETCH cur_issue_version BULK COLLECT INTO pv_issue_version_col ;
    CLOSE cur_issue_version ;
    END ;
    PROCEDURE get_all_issue_col_v1
    ( pv_issue_version_col OUT NOCOPY issue_version_col_t
    , pv_row_count IN number
    , pv_issuer_id IN VARCHAR2
    AS
    CURSOR cur_issue_version
    IS
    SELECT
    issue_version_t (
    SHARE_OUTST_T (so.shr_outst_amt )
    , SECURITY_T ( s.vote_per_shr
    , s.sec_cusip
    , s.PRI_MKT_EXCH_CD
    , s.IV_TYPE_CD
    , s.SEC_TICKER_SYMB )
    , ALTERNATE_ID_T (a.ALT_ID_TYPE)
    , ISSUER_T (i.ISSR_ID )
    , ISSUE_MAINT_VERSION_T (imv.im_key_id
    , imv.im_ver_num
    , imv.eff_tmstmp
    , imv.exp_tmstmp
    , imv.next_review_tmstmp
    , imv.appr_status_ref_id
    , imv.vote
    , imv.add_usr_id
    , imv.add_tmstmp
    , imv.upd_usr_id
    , imv.upd_tmstmp
    , imv.lock_level_num
    , NULL )
    , ISSUE_SHARE_MAINT_T (ism.im_key_id
    , ism.im_ver_num
    , ism.shr_outst_amt
    , ism.curr_outst_amt
    , ism.add_usr_id
    , ism.add_tmstmp
    , ism.upd_usr_id
    , ism.upd_tmstmp
    , ism.lock_level_num
    , NULL)
    , ISSUE_MAINT_COMMENT_T(imc.im_key_id
    , imc.im_ver_num
    , imc.comment_txt
    , imc.add_usr_id
    , imc.add_tmstmp
    , imc.upd_usr_id
    , imc.upd_tmstmp
    , imc.lock_level_num
    , NULL )
    FROM
    share_outst so
    , security s
    , alternate_id a
    , issuer i
    , issue_maintenance_version imv
    , issue_share_maintenance ism
    , issue_maintenance_comment imc
    WHERE
    s.sec_key_id = so.SEC_KEY_ID
    and s.SEC_KEY_ID = a.SEC_KEY_ID
    and s.MSTR_ISSR_KEY_ID = i.ISSR_KEY_ID
    and s.SEC_CUSIP = imv.SEC_CUSIP (+)
    and s.SEC_CUSIP = ism.SEC_CUSIP (+)
    and imv.IM_KEY_ID = imc.IM_KEY_ID (+);
    BEGIN
    OPEN cur_issue_version ;
    FETCH cur_issue_version BULK COLLECT INTO pv_issue_version_col ;
    CLOSE cur_issue_version ;
    END ;
    ====================
    When I execute this stored procedure thru rapid sql, I get error
    Error: ORA-06550: line 1, column 21:
    PLS-00306: wrong number or types of arguments in call to 'GET_ALL_ISSUE_VERSION_COL'
    ORA-06550: line 1, column 21:
    PL/SQL: Statement ignored, Batch 1 Line 1 Col 21
    What is that I am missing?
    Any help would be greatly appreciated.

    I've never tried Rapid SQL, but my guess is that you can't pass objects through it. I'd write a test case on the server and try it there. It looks like it should work but I didn't build a test case. If it works on the server but not in the tool, it's like the tool. OCI8 doesn't support passing instantiated objects.

  • Customize the stored procedure migrating of MWB

    Hi, All,
    Is there anybody know how much customize we can have for using
    the MWB when migrate stored procedure? For sample I have a SQL
    Server 6.5 strored procedure like following:
    /******************* SQL Server 6.5 sp *************/
    CREATE PROCEDURE sp_SelectUsers
    AS
    select
    tbl_Sp_users.ID, UserName, Password, ExpiresOn,
    PwdChangedDate, tbl_Sp_UserGrps.name
    from
    tbl_Sp_users, tbl_Sp_UserGrps
    where
    GroupID = tbl_Sp_UserGrps.id
    order by username
    /******************* end ***************************/
    After I migrate it to Oracle 8 with MWB, I got following object,
    one Pkg and one Procedure in Oracle db, like following:
    /****************** Oracle Pkg **********************/
    CREATE OR REPLACE PROCEDURE sp_SelectUsers(
    RC1 IN OUT sp_SelectUsersPkg.RCT1)
    AS
    StoO_selcnt INTEGER;
    StoO_error INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
    StoO_sqlstatus INTEGER;
    BEGIN
    OPEN RC1 FOR
    SELECT tbl_Sp_users.ID, UserName, Password,
    ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
    tbl_Sp_users, tbl_Sp_UserGrps
    WHERE GroupID = tbl_Sp_UserGrps.id
    ORDER BY username ;
    END sp_SelectUsers;
    /******************* Oracle Procedure ****************/
    PROCEDURE sp_SelectUsers(
    RC1 IN OUT sp_SelectUsersPkg.RCT1)
    AS
    StoO_selcnt INTEGER;
    StoO_error INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
    StoO_sqlstatus INTEGER;
    BEGIN
    OPEN RC1 FOR
    SELECT tbl_Sp_users.ID, UserName, Password,
    ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
    tbl_Sp_users, tbl_Sp_UserGrps
    WHERE GroupID = tbl_Sp_UserGrps.id
    ORDER BY username ;
    END sp_SelectUsers;
    /******************* end *****************************/
    As our client use RDO as access method, there is no way we can
    use this migrated SP in RDO and return resultset. We need
    convert this SP to following to be able to use RDO to get
    resultset back in client:
    /******************* need convert to *********************/
    create or replace package sp_selectUsersPkg
    as
    cursor c1
    is select tbl_Sp_users.ID, UserName, Password,ExpiresOn,
    PwdChangedDate, tbl_Sp_UserGrps.name
    from tbl_Sp_users, tbl_Sp_UserGrps
    where GroupID = tbl_Sp_UserGrps.id
    order by username;
    type UsersCur
    is ref cursor return c1%ROWTYPE;
    procedure sp_selectUsers(UserCursor in out UsersCur );
    END;
    create or replace package body sp_selectUsersPkg
    as
    procedure sp_selectUsers(UserCursor in out UsersCur )
    is
    begin
    open UserCursor for
    select tbl_Sp_users.ID, UserName,
    password, ExpiresOn,
    PwdChangedDate, tbl_Sp_UserGrps.name
    from tbl_Sp_users, tbl_Sp_UserGrps
    where GroupID = tbl_Sp_UserGrps.id
    order by username;
    end;
    end;
    /******************* end *********************************/
    Is there any idea how we can do this? I hope we don't need do
    this manually.
    Thank you very much for any help!
    Jing
    null

    I have done a rough example of using VB6, RDO and ODBC
    drivers, which may be of help to some workbench users:
    Calling Oracle 8.1.5 stored procedures with ref cursors using RDO
    and Visual
    Basic.
    Ver 0.1 [email protected]
    Summary
    Versions Used
    Table
    Code
    With Explicit Ref Cursor Argument
    Without Explicit Ref Cursor Argument
    Actions
    Summary
    This gives a comparison of the connectivity between Visual Basic
    and Oracle,
    with both the intersolve and oracle drivers. The Oracle odbc
    still has
    significant
    shortcomings in comparison to the intersolve/Merant driver.
    Versions Used
    Visiual Basic 6.0, Oracle odbc driver 8.1.5.3.0, Oracle Database
    8.1.5.0.0 on
    NT, intersolve/Merant 3.5 32 bit Oracle driver.
    Table
    html table replaced by rough results in ascii form
    test case with named result set cursor variable:
    sSQL = "{CALL reftest.GetEmpData(?)}"
    oracle 8.1.5.3
    could not find item indicated by text, known vb6.0 bug?, thinks
    reftest is user
    intersolve
    could not find item indicated by text, known vb6.0 bug?, thinks
    reftest is user
    sSQL = "begin reftest.GetEmpData(?); end;"
    oracle 8.1.5.3
    run time error 40002 driver not capable
    intersolve
    ok
    sSQL = "{CALL GetEmpData(?)}"
    oracle 8.1.5.3
    run time error 40002 driver not capable
    intersolve
    could not find item indicated by text,?(similar to bug above?)
    at qd.rdoParameters(0).Type = rdTypeVARCHAR
    sSQL = "begin GetEmpData(?); end;"
    oracle 8.1.5.3
    run time error 40002 driver not capable
    intersolve
    ok
    procedure with result set last argument wanting to be simulated
    as not
    argument result set
    strsql = "{CALL BYROYALTYPkg.byroyalty()}"
    oracle 8.1.5.3
    ok
    intersolve
    ok
    strsql = "begin BYROYALTYPkg.byroyalty(); end;"
    oracle 8.1.5.3
    wrong number of arguments in byroyalty
    intersolve
    ok
    strsql = "{CALL byroyalty() }"
    oracle 8.1.5.3
    wrong number of arguments
    intersolve
    ok
    strsql = "begin byroyalty(); end;"
    oracle 8.1.5.3
    wrong number of arguments
    intersolve
    ok
    Code
    With Explicit Ref Cursor Argument
    Oracle Stored Procedures and Packages
    (on scott/tiger account)
    create or replace package reftest as
    cursor c1 is select ename from emp;
    type empCur is ref cursor return c1%ROWTYPE;
    procedure GetEmpData(EmpCursor in out empCur );
    END;
    create or replace package body reftest as
    procedure GetEmpData(EmpCursor in out empCur) is
    begin
    open EmpCursor for select ename from emp;
    end;
    end;
    create or replace procedure GetEmpData(EmpCursor in out
    reftest.empCur)
    is
    begin
    open EmpCursor for select ename from emp;
    end;
    VB code
    Private Sub Command1_Click()
    Dim cn As New rdoConnection
    Dim qd As rdoQuery
    Dim rs As rdoResultset
    Dim cl As rdoColumn
    Static Number As Integer
    Number = 0
    cn.Connect = "uid=scott; pwd=tiger; DSN=Oracle;"
    'enable the MS Cursor library
    cn.CursorDriver = rdUseOdbc
    'Make the connection
    cn.EstablishConnection rdDriverPrompt
    sSQL = "BEGIN GetEmpData(?); END;"
    Set qd = cn.CreateQuery("", sSQL)
    qd.rdoParameters(0).Type = rdTypeVARCHAR
    'Dynamic or Keyset is meaningless here
    Set rs = qd.OpenResultset(rdOpenStatic)
    'all the output is routed to the debug window
    Debug.Print ".....Starting Result Sets....."
    Do
    Debug.Print
    Debug.Print
    Do Until rs.EOF
    For Each cl In rs.rdoColumns
    If IsNull(cl.Value) Then
    Debug.Print " "; cl.Name; "NULL"; 'Error
    trap for
    null fields
    Else
    Debug.Print " "; cl.Name; " ";
    cl.Value;
    End If
    Next
    Debug.Print
    rs.MoveNext
    Loop
    Loop While rs.MoreResults
    cn.Close
    End Sub
    Without Explicit Ref Cursor Argument
    Oracle Stored Procedures and Packages
    (requires table:
    SQL> desc MTG_VERSION
    Name
    Null?
    Type
    VERSION
    NUMBER
    create or replace PACKAGE BYROYALTYPkg AS
    TYPE RT1 IS RECORD (
    val MTG_VERSION.VERSION%TYPE
    TYPE RCT1 IS REF CURSOR RETURN RT1;
    PROCEDURE byroyalty(
    RC1 IN OUT BYROYALTYPkg.RCT1);
    END;
    create or replace PACKAGE BODY BYROYALTYPkg AS
    PROCEDURE byroyalty(
    RC1 IN OUT BYROYALTYPkg.RCT1)
    AS
    StoO_selcnt INTEGER;
    StoO_error INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
    StoO_sqlstatus INTEGER;
    BEGIN
    OPEN RC1 FOR
    SELECT VERSION FROM MTG_VERSION;
    END byroyalty;
    END;
    create or replace PROCEDURE byroyalty(
    RC1 IN OUT BYROYALTYPkg.RCT1)
    AS
    StoO_selcnt INTEGER;
    StoO_error INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
    StoO_sqlstatus INTEGER;
    BEGIN
    OPEN RC1 FOR
    SELECT VERSION FROM MTG_VERSION;
    END byroyalty;
    VB code
    Dim env1 As rdoEnvironment
    Dim conn1 As rdoConnection
    Dim strsql As String
    Dim ps As rdoPreparedStatement
    Dim rs As rdoResultset
    Private Sub Command1_Click()
    strsql = "begin byroyalty(); end;"
    'in oracle odbc driver uses refcusor argument to
    get result set
    Set ps = conn1.CreatePreparedStatement("PsTest",
    strsql)
    Set rs = ps.OpenResultset(rdOpenStatic)
    Text1 = rs!Version
    rs.Close
    End Sub
    Private Sub Form_Load()
    rdoEngine.rdoDefaultCursorDriver = rdUseOdbc
    Set env1 = rdoEngine.rdoCreateEnvironment(" ", " ", " ")
    strsql = "ODBC;DSN=tot4;UID=test;PWD=test;"
    Set conn1 = env1.OpenConnection(" ", rdDriverPrompt, False,
    strsql)
    conn1.QueryTimeout = 3600
    End Sub
    Actions
    Encourage odbc to allow result sets , via the odbc processed
    extra
    argument, outside of packages.
    Document the current situation, and keep users informed of
    developments.
    Turloch
    Oracle Migration Workbench Team
    Turloch O'Tierney (guest) wrote:
    : Jing,
    : Note that there is an example in the FAQ where the intersolve
    : driver was used so no change was required in the client code.
    The
    : intersolve driver optionally converts the extra argument into a
    : result set. With the Oracle ODBC driver the argument needs to
    be
    : explicitly handled.
    : Is there a problem with RDO and the 8.0.5 ODBC driver handling
    : package references?
    : Turloch
    : Turloch O'Tierney
    : Oracle,
    : Migration and Technology Group.
    : FAQ entry reproduced:
    : How are result sets/dynasets returned to the calling program?
    : The Oracle Migration Workbench parser adds an extra
    argument
    : of type REF CURSOR for result
    : sets/dynasets. This type is understood and can be
    : manipulated by both PL/SQL and Oracle JDBC. Oracle8
    : release 8.0.5 ODBC drivers support REF CURSORs which means
    : that the additional argument must be
    : explicitly handled by the application, and the client
    : application code must be changed. However, some
    : third-party vendors such as Intersolv supply ODBC drivers
    : for Oracle that support REF CURSORs and can, in
    : addition, implicitly make use of REF CURSORs for using
    : result sets/dynasets. Therefore, no change is
    : required in the client application code. This is
    illustrated
    : in the following examples of an MS SQL Server
    : stored procedure and its equivalent Oracle package and
    : stored procedure as generated by the Oracle
    : Migration Workbench parser.
    : MS SQL Server Stored Procedure
    : CREATE PROCEDURE byroyalty
    : AS
    : select au_id from titleauthor
    : GO
    : Oracle8i Package and Stored Procedure
    : PACKAGE BYROYALTYPkg AS
    : TYPE RT1 IS RECORD (
    : au_id titleauthor.au_id%TYPE
    : TYPE RCT1 IS REF CURSOR RETURN RT1;
    : END;
    : PROCEDURE byroyalty(
    : RC1 IN OUT byroyaltyPkg.RCT1)
    : AS
    : StoO_selcnt INTEGER;
    : StoO_error INTEGER;
    : StoO_rowcnt INTEGER;
    : StoO_errmsg VARCHAR2(255);
    : StoO_sqlstatus INTEGER;
    : BEGIN
    : OPEN RC1 FOR
    : SELECT au_id FROM titleauthor;
    : END byroyalty;
    : The following example illustrates the typical ODBC code
    used
    : by Intersolv to call the above MS SQL Server
    : stored procedure. This code also works for the above
    : Oracle8i package and stored procedure. Note that error
    : handling must be added in a real application:
    : SQLPrepare(...,'{call byroyalty()}',...)
    : SQLExecute()
    : SQLBindCol()
    : SQLFetch()
    : Comments:
    : SQLPrepare(...,'{call byroyalty()}',...) is the ODBC SQL
    : syntax used to execute stored procedures.
    : SQLExecute()executes the stored procedure.
    : SQLBindCol()assigns storage for result column 1 in the
    : result set (au_id).
    : SQLFetch() fetches the first record from the result set
    : generated by the stored procedure.
    : The following examples illustrate how to call the above MS
    : SQL Server stored procedure with result
    : sets/dynasets in Visual Basic using DAO and RDO on top of
    : ODBC. This code works for Oracle8i packages
    : and stored procedures if you use an Intersolv ODBC driver
    to
    : understand Oracle REF CURSORs.
    : DAO
    : Private Sub Command2_Click()
    : Dim sSql As String
    : sSql = "{call byroyalty()}"
    : 'In Oracle ODBC driver use refcusor argument to get
    : result set
    : Set rCustomers = dbsServer.OpenRecordset(sSql,
    : dbOpenDynamic)
    : Text4 = rCustomers.Fields(0)
    : theend:
    : End Sub
    : Please note, this example assumes that a DAO connection
    has
    : been set up already.
    : RDO
    : Private Sub Command1_Click()
    : StrSql = "{call byroyalty}"
    : 'in oracle odbc driver uses refcusor argument to get
    : result set
    : Set Ps = connx1.CreatePreparedStatement("PsTest",
    : StrSql)
    : Set Rs = Ps.OpenResultSet(rdOpenStatic)
    : Text3 = Rs!au_id
    : Rs.Close
    : End Sub
    : Please note, this example assumes that an RDO connection
    has
    : been set up already.
    : Jing Zhang (guest) wrote:
    : : Hi, All,
    : : Is there anybody know how much customize we can have for
    using
    : : the MWB when migrate stored procedure? For sample I have a
    SQL
    : : Server 6.5 strored procedure like following:
    : : /******************* SQL Server 6.5 sp *************/
    : : CREATE PROCEDURE sp_SelectUsers
    : : AS
    : : select
    : : tbl_Sp_users.ID, UserName, Password, ExpiresOn,
    : : PwdChangedDate, tbl_Sp_UserGrps.name
    : : from
    : : tbl_Sp_users, tbl_Sp_UserGrps
    : : where
    : : GroupID = tbl_Sp_UserGrps.id
    : : order by username
    : : /******************* end ***************************/
    : : After I migrate it to Oracle 8 with MWB, I got following
    : object,
    : : one Pkg and one Procedure in Oracle db, like following:
    : : /****************** Oracle Pkg **********************/
    : : CREATE OR REPLACE PROCEDURE sp_SelectUsers(
    : : RC1 IN OUT sp_SelectUsersPkg.RCT1)
    : : AS
    : : StoO_selcnt INTEGER;
    : : StoO_error INTEGER;
    : : StoO_rowcnt INTEGER;
    : : StoO_errmsg VARCHAR2(255);
    : : StoO_sqlstatus INTEGER;
    : : BEGIN
    : : OPEN RC1 FOR
    : : SELECT tbl_Sp_users.ID, UserName, Password,
    : : ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
    : : tbl_Sp_users, tbl_Sp_UserGrps
    : : WHERE GroupID = tbl_Sp_UserGrps.id
    : : ORDER BY username ;
    : : END sp_SelectUsers;
    : : /******************* Oracle Procedure ****************/
    : : PROCEDURE sp_SelectUsers(
    : : RC1 IN OUT sp_SelectUsersPkg.RCT1)
    : : AS
    : : StoO_selcnt INTEGER;
    : : StoO_error INTEGER;
    : : StoO_rowcnt INTEGER;
    : : StoO_errmsg VARCHAR2(255);
    : : StoO_sqlstatus INTEGER;
    : : BEGIN
    : : OPEN RC1 FOR
    : : SELECT tbl_Sp_users.ID, UserName, Password,
    : : ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
    : : tbl_Sp_users, tbl_Sp_UserGrps
    : : WHERE GroupID = tbl_Sp_UserGrps.id
    : : ORDER BY username ;
    : : END sp_SelectUsers;
    : : /******************* end *****************************/
    : : As our client use RDO as access method, there is no way we
    can
    : : use this migrated SP in RDO and return resultset. We need
    : : convert this SP to following to be able to use RDO to get
    : : resultset back in client:
    : : /******************* need convert to *********************/
    : : create or replace package sp_selectUsersPkg
    : : as
    : : cursor c1
    : : is select tbl_Sp_users.ID, UserName, Password,ExpiresOn,
    : : PwdChangedDate, tbl_Sp_UserGrps.name
    : : from tbl_Sp_users, tbl_Sp_UserGrps
    : : where GroupID = tbl_Sp_UserGrps.id
    : : order by username;
    : : type UsersCur
    : : is ref cursor return c1%ROWTYPE;
    : : procedure sp_selectUsers(UserCursor in out UsersCur );
    : : END;
    : : create or replace package body sp_selectUsersPkg
    : : as
    : : procedure sp_selectUsers(UserCursor in out UsersCur )
    : : is
    : : begin
    : : open UserCursor for
    : : select tbl_Sp_users.ID, UserName,
    : : password, ExpiresOn,
    : : PwdChangedDate, tbl_Sp_UserGrps.name
    : : from tbl_Sp_users, tbl_Sp_UserGrps
    : : where GroupID = tbl_Sp_UserGrps.id
    : : order by username;
    : : end;
    : : end;
    : : /******************* end *********************************/
    : : Is there any idea how we can do this? I hope we don't need do
    : : this manually.
    : : Thank you very much for any help!
    : : Jing
    Oracle Technology Network
    http://technet.oracle.com
    null

  • Killing the Stored Procedure

    Hi All,
    I'm having a serious and urgent problem.
    Please help me in resolving this.
    I'm trying to excute a Oracle Stored Procedure from the JSP Screen.
    I.e When i click a Button in the Screen it will run the Stored Procedure (Update a table) at Background.
    Where i require help is...
    I'm clicking the Button to execute my Stored procedure. It has started the processes and running the Stored Procedure at backgroud.
    Due to connection failure or by mistake i have clicked the button again to run the Stored Procedure before the first process gets completed.
    What will be the behaviour of the System??
    Will the data be updated twice in the Table??
    Will it so table mutating error??
    If any of these situations occurs how to overcome it??
    Can i kill the first process before starting the second process, so that i will not get duplicate records in the table??
    Please give me some guideline.
    Regards,
    Gita

    Oh..my god this much complications.
    In my Stored Procedure i have not done anything other than fetching a number of rows through a cursor for certain condition and inserting that into a output table and commiting the changes.
    But the JSP is allowing to open multiple browers at the same time and process the stored procedure for the same parameters. This shows that the Stored Procedure is allowed to run for multiple seesions as it is nto showing any error message like dead lock or something.
    How to overcome this??
    Can i lock my Stored Procedure if it is clicked to run for the same parameters??
    If the Stored Procedure is triggered for the different parameters then do not lock it.
    I think diabling the button in JSP is of no use as it will be applicable only to that session. If my User opens a new session and process for the same parameter then it is of no use.
    Many Thanks for explaining the things..
    Regards,
    Gita

  • Only Restarting the Weblogic Server will invoke the Stored Procedure???

    Hi,
    I have written a stored procedure which is called using hibernate
    which is working fine when ever i restart the server(Weblogic). That is for each time, when i need to invoke the stored procedure i need to restart the server to invoke it then only the stored procedure gets invoked. Which is very expensive indeed. How to overcome this, is there any way to set in the weblogic server properties, so that i can dont have to restart the server every time when i need to invoke the Stored
    procedure. Any way please do look up the code as well in which i have called the stored procedure in Hibernate.
    public int callPopulateCertDataSP(String barCode,String containerType,String conditionValue) throws SystemException {
         log.debug("Inside the callStoredProcedure Method!!!");
         int checkValue=0;
         Session hibSession = HibernateUtils.getSession();
         Connection con=hibSession.connection();
         CallableStatement cstatement=null;
         if(con!=null){
    try {
         log.debug("Inside con object not null!!!");
              cstatement=con.prepareCall("{call p_populate_cert_data(?,?,?,?)}");
              cstatement.setString(1,barCode);
              cstatement.setString(2,containerType);
              cstatement.setString(3,conditionValue);
              cstatement.registerOutParameter(4,Types.INTEGER);
              cstatement.execute();
              checkValue=cstatement.getInt(4);
              cstatement.close();
              con.commit();
              con.close();
         }catch(SQLException e){
              log.debug("The error Message is what????"+e.getMessage());
         HibernateUtils.closeSession();
         return checkValue;          
    Expecting ur replies....
    Thanks,
    JavaCrazyLover

    No Replies as Yet!!!

  • Drop the stored procedure having null schema

    Hello All,
    I have 2 SPs with same name but different schema id , one 1(default) and other is 20 but when i check in sys.schemas it give no record for schema_id 20.
    i would like to drop the SP which has schema_id 20, i dont know the schema name for id 20 so not able to drop it.
    Please help me out to remove\drop the SP which has null schema.

    What version of SQL Server and service pack are your running? I've never seen this but you might try first try restarting SQL to rule cache corruption.  If the problem persists, below are some steps you can try.
    Run the query below to get the schema name from the stored procedure CREATE statement:
    SELECT m.definition
    FROM sys.procedures AS p
    JOIN sys.sql_modules AS m ON
    m.object_id = p.object_id
    WHERE OBJECT_SCHEMA_NAME(object_id) IS NULL;
    Query sys.schemas to identify gaps in schema_id values less than 20.  Create schemas with dummy names until schema_id 19 is assigned.  Then create a schema with the name retrieved from the proc schema and verify it has been assigned schema_id
    20.  Finally, try to drop the proc using the schema-qualified name.
    Is there anything unusual that might help explain what led to this problem.  Maybe a transfer of objects from one schema to another that went awry?
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Howto get information about Java Stored Procedures programmaticly

    Hi all,
    using the DatabaseMetaData object it is easily possible to get information about database objects like tables, columns or even plsql stored procedures.
    But is there a way to get information about Java Stored Procedures which are published in packages ? Is it possible here to use a DatabaseMetaData object or is there any other solution ?
    TIA,
    Chris

    What sort of information do you want to know about the Java stored procedures?
    Would the views USER_SOURCE or USER_OBJECTS contain the information you need?

  • Getting values from a stored procedure with no parameters

    Hi,
    I'm trying to get values out of a stored procedure that I created on SQL server. I'm trying to get XML values out of the database, but I'm not sure how to get any data out of it written to a file if the procedure doesn't have any parameters.
    So I'm just making a call:
    CallableStatement cs = conn.prepareCall("{call myproc}");
    cs.execute();How do I get values back from this stage?
    Thank you very much,
    Lior

    The short form answer, which assumes that the stored procedure is returning the XML as an out parameter would go something like this.
         public void build(String newUserID, String newPassword) throws SQLException {
              String sql = "{ call GET_ITEM_DETAIL(?, ?, ?, ?, ?, ?) }" ;
              try{
                   init(newUserID, newPassword) ;
                   setCallableStatement(getConnection().prepareCall(sql)) ;
                   getCallableStatement().setInt(1, getItemNumber()) ;
                   getCallableStatement().registerOutParameter(2, oracle.jdbc.driver.OracleTypes.CURSOR) ;
                   getCallableStatement().registerOutParameter(3, oracle.jdbc.driver.OracleTypes.INTEGER) ;
                   getCallableStatement().registerOutParameter(4, oracle.jdbc.driver.OracleTypes.VARCHAR);
                   getCallableStatement().registerOutParameter(5, oracle.jdbc.driver.OracleTypes.VARCHAR) ;
                   getCallableStatement().registerOutParameter(6, oracle.jdbc.driver.OracleTypes.VARCHAR) ;
                   getCallableStatement().execute() ;
                   setSqlResult(getCallableStatement().getInt(3)) ;
                   setSqlMessage(getCallableStatement().getString(4)) ;
                   if( getSqlResult() != 0 ){
                        throw new SQLException(getSqlMessage(), null, getSqlResult()) ;
                   setResultSet((java.sql.ResultSet) getCallableStatement().getObject(2)) ;
                   if( getResultSet() != null ){
                        while( getResultSet().next() ){
                             setItemType(getResultSet().getString("ITEM_TYPE")) ;
                             setItemValue(getResultSet().getString("ITEM_VAL")) ;
                             setDisplayType(getCallableStatement().getString(5)) ;
                             setDisplaySize(Integer.parseInt(getCallableStatement().getString(6))) ;
              catch(SQLException e){
                   java.util.Date now = new java.util.Date() ;
                   java.text.DateFormat format = java.text.DateFormat.getInstance() ;
                   setSqlMessage( e.getClass().getName() + " : " + format.format(now) + " : " + e.getMessage() + " : IN " + getClass().getName() ) ;
                   System.err.println(getSqlMessage()) ;
                   throw e ;
              finally{
                   closeResources() ;
         }The GET_ITEM_DETAIL stored procedure returns several out parameters of various types. The code registers them as out parameters along with an anticipated type and then calls the getXXX(n) method that corresponds with that data type in the appropriate position.
    As I mentioned in my other post, the onus of returning the XML is on the stored procedure, when you get it into Java it's going to be a java.lang.String that you can then parse by whatever means is appropriate to your situation.
    Regards,

  • How to get return values from stored procedure to ssis packge?

    Hi,
    I need returnn values from my stored procedure to ssis package -
    My procedure look like  and ssis package .Kindly help me to oget returnn value to my ssis package
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author: <Author,,Name>
    -- Create date: <Create Date,,>
    -- Description: <Description,,>
    -- =============================================
    ALTER PROCEDURE [TSC]
    -- Add the parameters for the stored procedure here
    @P_STAGE VARCHAR(2000)
    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for procedure here
    --SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2>
    truncate table [INPUTS];
    INSERT
    INTO
    [INPUTS_BASE]
    SELECT
    [COLUMN]
    FROM [INPUTS];
    RETURN
    END
    and i am trying to get the return value from execute sql task and shown below
    and i am taking my returnn value to result set variable

    You need to have either OUTPUT parameters or use RETURN statement to return a value in stored procedures. RETURN can only return integer values whereas OUTPUT parameters can be of any type
    First modify your procedure to define return value or OUTPUT parameter based on requirement
    for details see
    http://www.sqlteam.com/article/stored-procedures-returning-data
    Once that is done in SSIS call sp from Execute SQL Task and in parameter mapping tabe shown above add required parameters and map them to variables created in SSIS and select Direction as Output or Return Value based on what option you used in your
    procedure.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Error while executing the stored procedure through sender JDBC adapter

    Hi All,
    I am getting below error while executing the stored procedure through sender JDBC adapter.
    Database-level error reported by JDBC driver while executing statement 'exec SapgetNextEntity 'SalesOrder''. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor.
    what is the problem? any idea to anyone...
    regards
    Ramesh

    hi Dharamveer,
    I am not getting below statement for your reply
    Try to use Refrence Cursor it will return u reference of resultset.
    I mention SP like this
    exec SapgetNextEntity 'SalesOrder'
    SapgetNextEntity -
    > SP Name
    SalesOrder----
    > Parameter I am passing...
    regards
    Ramesh

  • In trying to update to Firefox 3.6.11 on an intel mac g5, I get this message: the operation cannot be completed because you do not have sufficient privileges for some of the items -- any suggestions? thanks!

    In trying to update to Firefox 3.6.11 on an intel mac g5, I get this message: the operation cannot be completed because you do not have sufficient privileges for some of the items -- any suggestions? thanks!

    You can try to repair the permissions for the Firefox application files and folders.
    You can also do this:
    * Download a new copy of the Firefox program: http://www.mozilla.com/firefox/all.html
    * Trash the current Firefox application to do a clean (re)install.
    * Install the new version that you have downloaded.
    Your profile data is stored elsewhere in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder], so you won't lose your bookmarks and other personal data.

  • Sender JDBC support the stored procedure in SQL Server 2005

    Dear All,
    My question here is , Sender is JDBC adpter support to call the Stored procedure in Microsoft SQL Server 2005?
    I followed the below thread before posting this question
    Sender JDBC Adapter Supports Stored Procedures????
    In the thread Suraj response has mentioned SAP note: 941317, I checked the note, Note says it supported only ORACLE DBMS versions.
    Could you please clarify about this to possibility to call the stored procedure in Microsoft SQL server 2005?
    Thank you in Advance
    Sateesh

    Hi Sateesh,
    To answer your query, Yes it does. SP call works with SQL Server 2005 as well, the SP call should be "execute SPNAME <paramas>". In the place of update statement put any junk value as mentioned in the earlier comment.
    But just one thing to be noted, the select or any other query returning the desired resultset must be the first statement in youre SP returning value to the calling app. Means if there are any update, deletion or intermediate select queries to be used with in your SP, those all should be placed after the Main Select query that returns the desired resultset. Variable declarions and assignments are allowed.
    But if the seq of statements in your SP are like:
    @var1 Varchar
    Update <tablename>....
    Select * from <tablename>
    Then the output of the SP is :
    1 row updated
    <the resultset from select>
    In such cases, PI can recognise the first value returned only, that is "1 row updated" and hence the returned resultset wouldn't be seen by PI or not be passed to integration engine. Hence the update should come after the main Select.
    One more interesting piece of information, even if you copy and paste the entire SP code in place of the query string of Sender JDBC adapter, that too will work with all your variable declarations, multiple queries and updates and everything. Just have to follow the above rule.
    Let us know what you find.
    Regards,
    Suddhasatta

  • Calling postChanges() Before a Stored Procedure

    I am using JDeveloper 11.1.1.2 and ADF with BC. I have the following situation:
    I am updating a record via an updatable view object. When I click commit, I also need to call an existing stored procedure on my database to do some updates. The stored procedure queries the table upon which my entity object is based and makes updates to other tables/records based on that information. If there is an error in the stored procedure, then I want to roll back the changes in my app module, so I don't want to commit the app module changes until I know the stored procedure was successful. But the stored procedure can't see my view object changes until they are commited (or changes are posted).
    I am considering the following:
    (1) Make changes to view object
    (2) Call postChanges() on my app module's transaction
    (3) Call the stored procedure via PreparedStatement
    (4) Commit (if errors, rollback)
    Is this the preferred method for this situation?
    Thanks,
    Brad

    Brad,
    As long as the stored procedure does not commit, there are no autonomous transactions and you can guarantee that postChanges() and commit() will be called in the same request, I think you should be OK.
    Nick

  • Java App connection to an Oracle Database through Oracle Stored Procedure

    My team's access to its Databases (Oracle only) is restricted to access through Oracle Stored Procedures that are part of the Oracle Database. So, in my Java App I need to call the Stored Procedure that will give me the access to the table that I need, declare the right parameters and execute the command. The Stored Procedure will then hand me the data I need.
    I am finding support on the web for creating Stored Procedures in Java, but that is not what I need.
    Can anyone post here a class that addresses this, or point me to a link that will shed some light on it?
    Thanks
    user606303

    user606303 wrote:
    Sorry this code is unformatted - I can't see how to format it.Use \ tags
    I am looking for Java code that will do what this .NET code below does (connects to a database and writes data to the table through an Oracle stored procedure that is part of the Oracle Database.)
    So learn Java, learn JDBC and translate the requirements; don't attempt to translate the code as the platforms are too different.
    From a quick glance it looks like a JDBC CallableStatement can do the job.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Can rs.last() be used after calling the stored procedure?

    Can rs.last() be used after calling the stored procedure? If yes what should be the CURSOR types?

    Can rs.last() be used after calling the stored
    procedure? If yes what should be the CURSOR types?That would depend on the driver/database.
    And as I said in your other post it is far more efficient to count records by just returning a count rather than a complete collection regardless of how you get to the end.

Maybe you are looking for