Cursor open error SQLSTT - 72000, SQL code - 969

We have purchased a product called Access Manager for DB2 and installed it on our AS400. This gives us the connectivitiy to Oracle server with which we do the Warehouse management software interface using our legacy system on AS400.
I have written several programs in SQLRPGLE and not quite sure as to how I can handle errors coming out of Oracle server.
As per my knowledge in my programs, I do
declare cursor
open cursor
fetch
dow look for sqlstate
fetch next row
enddo
close cursor
I am also new to this much of SQL.
Now, my programs are running in production and works just fine if we don;t have any issues with oracle server (database server down etc.).
My question is if the database server goes down for any reason, my SQLRPGLE progam starts giving me cursor not open errors, the actual error is as follows:
Connection to relational database HJAWCD1 already exists.
ARDUPAR: ARDUPAR: rc=-1(OCI_ERROR) from OCIStmtExecute when asking for
Describe-Info
ARDUPAR(1): ORA-03114: not connected to ORACLE
ARDAROC: rc = -1 from parse
SQLSTATE class unknown - SQLSTATE 72000, SQLCODE -969.
Cursor SEHOST not open.
Cursor SEHOST not open.
Cursor SEHOST not open.
So although, the connection exist between the AS400 and Oracle server as suggested from first statement, but then the cursor is giving me problems of not opening.
what I would like to know is how do I check in my SQL statement the error and somehow reconnect and open the cursor again.
Please help in this regard, since I am not finding any help from iseries world becuase no one seems to have knowledge about this product that we have installed and I don;t have too mcuh of documentation on the product nor do I have any sample handling messages program using RPGLE between oracle and AS400 using the product.
Regards
Farhan Qadri

It's been over a decade since I worked on an AS/400 (iSeries), but I've seen an ORA-03114 is thrown from the OCI when you've attempted an illegal statement. That error typically means you are no longer connected to the database. I'd guess that your new application has a defective RPG error management routine.
Good luck, Michael

Similar Messages

  • Too many Cursors open error

    I have been getting this error in my Jdeveloper App.
    ORA-01000 : maximum open cursors exceeded.
    We have open cursors set at 220. I am using straight JDBC thin
    to call the database (8.1.5) and have been closing ResultSets
    the best I can. It happens after I use the app for a little bit.
    Any suggestions on what is causing this.
    PS
    This is a test database and I am the only one on it.
    Thanks
    Greg
    null

    PreparedStatement ps = null;
    RsultSet rs = null;
    try {
    // Do work here
    } catch (Exception erx) {
    // handle error
    } finally {
    try { rs.close(); } catch {}
    try { ps.close(); } catch {}
    In this way, you should never leave a cursor open.
    null

  • FK error in PL/SQL code.

    I have a application with the following code.
    Declare
    v_num_req varchar2(100); --Recebe o codigo da requisição
    v_cont number; --Conta a quantidade de aparições
    BEGIN
    --Busca o codigo da requisição
    select cod_requisicao
    into v_num_req
    from requisicao
    where cod = :p72_cod_requisicao;
    --Conta o numero de vezes em que aparece a requisição
    select count(numero_documento)
    INTO v_cont
    from amx_documento
    where numero_documento = v_num_req;
    --Se não aparecer nenhuma requisição
    IF (v_cont = 0) then
    BEGIN
    --Insere a movimentação
    INSERT INTO AMX_MOVIMENTACAO_MATERIAL(COD, NUM_GUIA, NUM_EMPENHO,DT_EMISSAO_EMPENHO ,DESTINO, DT_MOVIMENTACAO, COD_TIPO_MOVIMENTACAO, COD_ALMOXARIFADO, COD_STATUS)
    VALUES (AMX_MOVIMENTACAO_MATERIAL_SEQ.NEXTVAL ,to_char(sysdate, 'YYYY/DDMM-SSSSS'),'123SIS',sysdate,175120,sysdate,301,AMX_ALMOXARIFADO_PADRAO(:app_user),2);
    --Insere o documento
    Insert into amx_documento(cod,cod_movimentacao,cod_tipo_documento,valor_documento,numero_documento)
    values(amx_documento_seq.nextval,amx_movimentacao_material_seq.currval,261,0000,v_num_req);
    --inicia o cursor com os materiais.
    for c_item_req in(
    SELECT
    a.cod cod_mat,
    a.qtd_fornecida
    FROM
    item_requisicao a
    INNER JOIN requisicao e on a.cod_requisicao = e.cod
    INNER JOIN AMX_MATERIAL b ON a.cod_material=b.cod
    LEFT JOIN AMX_ESTOQUE c ON a.cod_material=c.cod_material
    AND c.cod_almoxarifado = :p72_almoxarifado
    WHERE
    a.cod_requisicao = :p72_cod_requisicao
    LOOP
    --Insere os items do documento.
    insert into amx_documento_item(cod,quantidade,valor_total,cod_material,cod_documento)
    values(AMX_MOVIMENTACAO_ITEM_SEQ.nextval,c_item_req.qtd_fornecida,00,c_item_req.cod_mat,amx_documento_seq.currval);
    END LOOP;
    END;
    end if;
    end;
    When run, return a error because of the FK cod_material in still new in the PL/SQL world, so please help me.

    post also the complete returned error message.

  • ORA-01007 - variable not in select list error in pl\sql code

    Hi,
    When I tried to run this program I am getting below error:
    ORA-01007 - variable not in select list.Please help to resolve.
    Code:
    create or replace procedure "XX_BPM_DATA_P" (P_PROCESS_ID IN VARCHAR2)
    is
    TYPE l_entity_type IS TABLE OF xx_BPM_data.ENTITY%TYPE INDEX BY PLS_INTEGER;
    TYPE l_data_type IS TABLE OF XX_BPM_DATA.DATA%TYPE INDEX BY PLS_INTEGER;
    TYPE l_count_type IS TABLE OF XX_BPM_DATA.count%TYPE INDEX BY PLS_INTEGER;
    l_Entity_v l_Entity_type;
    l_data_v l_data_type;
    l_count_v l_count_type;
    l_security_group_id number;
    app_id number(20);
    l_Actual_value XX_BPM_DATA.DATA%TYPE;
    cursor BPM_CUR is select id,process_id , sequence, to_char(query) query,report_num from xx_test_bpm_dynamic
    where
        process_id = p_process_id
           and report_num=1
    order by process_id, sequence;
    BEGIN
    --delete xx_bpm_data where process_id = p_process_id;
    for bpm_rec in bpm_cur
    loop
    delete xx_bpm_data
    where process_id = bpm_rec.process_id
    and sequence = bpm_rec.sequence
    and report_num = bpm_rec.report_num;
    l_security_group_id := apex_custom_auth.get_session_id_from_cookie;
    --dbms_output.put_line(l_security_group_id);
    execute immediate bpm_rec.query BULK COLLECT INTO l_ENTITY_v,l_DATA_v,l_count_v;
    if (bpm_rec.report_num=2) then
    app_id:= 108;--NV('APP_ID');
    FORALL i IN l_ENTITY_v.FIRST..L_ENTITY_V.LAST
    INSERT INTO XX_BPM_DATA
        (EnTITY,
    value,data,count,
    Process_ID,
    Sequence,report_num)
    VALUES(l_entity_v(i),
    l_data_v(i),
    '<A HREF="f?p='||app_id||':301:'||':APP_SESSION'||'::::P301_process_id,p301_sequence,p301_id,p301_entity:'||bpm_rec.process_id||','||bpm_rec.sequence||','||bpm_rec.id||','||l_entity_v(i)||':">'||l_data_v(i)||'</A>',
        l_count_v(i),bpm_rec.process_id,
    BPM_rec.sequence,
    bpm_rec.report_num);
    else
    FORALL i IN l_ENTITY_v.FIRST..L_ENTITY_V.LAST
    INSERT INTO XX_BPM_DATA(EnTITY,data,
        count,
    Process_ID,
    Sequence,report_num)
    VALUES(l_entity_v(i),
    l_data_v(i),
        l_count_v(i),
        bpm_rec.process_id,
    BPM_rec.sequence,
    bpm_rec.report_num);
    end if;
    select round(avg(value),2) into l_actual_value from xx_bpm_data where process_id=bpm_rec.process_id and sequence=bpm_rec.sequence and report_num=bpm_rec.report_num;
    update xx_test_bpm_dynamic set value=l_actual_value where process_id=bpm_rec.process_id and sequence=Bpm_rec.sequence and report_num= bpm_rec.report_num;
    end loop;
    Commit;
    END;

    When I tried to run this program I am getting below error:
    ORA-01007 - variable not in select list.Please help to resolve.
    You likely would not need any help in you wrote and tested your code using standard best practices.
    Your code has NO exception handler and you are NOT identifying each step in the code so that the exception handler could print/log a message telling you EXACTLY which step raised the exception.,
    v_step NUMBER;
    -- before step 1
    v_step := 1;
    -- before step 2
    v_step := 2;
    Then in the exception handler the value of 'v_step' will tell you which step raised the exception.
    The exception you posted refers to a 'select list' so examine ALL of the select lists in your code. If you do that you will see that the primary query being run is obtained from a database table and then executed using dynamic SQL
    execute immediate bpm_rec.query BULK COLLECT INTO l_ENTITY_v,l_DATA_v,l_count_v;
    We have no way of knowing what query is in 'bpm_rec.query' when the exception happens or what columns that query returns. For all we know the query returns 2 columns and you are trying to load 3 collections. Or maybe the query returns 8 columns and you are trying to load 3 collections.
    Why don't you print out the query and execute it manually so you can see exactly what the result set looks like?
    dbms_output.put_line(bpm_rec.query);
    And don't even get us started on why you are using such security-prone dynamic sql to perform this processing instead of using ordinary SQL statements. Or why you are using associative arrays for the BULK COLLECT instead of nested tables.
    In short your code could blow up in several places and, because you have NO logging statements, control statements or exception handlers, anyone having to troubleshoot that code would have absolutely no idea what part of it may be the problem.

  • Error in Pl/sql code

    create or replace
    PACKAGE BODY SF_CSD_CreateOrder
    AS
    G_PKG_NAME CONSTANT VARCHAR2(30) :='SF_CSD_CreateOrder';
    PROCEDURE Create_Order
    p_api_version_number IN NUMBER,
    p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
    p_commit IN VARCHAR2 := FND_API.G_FALSE,
    x_return_status OUT NOCOPY VARCHAR2,
    x_msg_count OUT NOCOPY NUMBER,
    x_msg_data OUT NOCOPY VARCHAR2,
    p_order_rec IN ORDER_HDR_REC,
    p_order_lines IN ORDER_LINE_REC_TBL )
    IS
    l_api_name CONSTANT VARCHAR2(30) := 'Create_Order';
    l_api_version_number CONSTANT NUMBER := 1.0;
    lx_incident_id NUMBER(10);
    lx_incident_number VARCHAR2(50);
    lx_return_status VARCHAR2(1);
    lx_msg_count NUMBER(10);
    lx_msg_data VARCHAR2(2000);
    l_incident_id NUMBER;
    l_repair_line_id NUMBER;
    l_repair_number NUMBER;
    xx_ro_status VARCHAR2(1);
    xl_return_status VARCHAR2(1);
    xl_msg_count NUMBER;
    xl_msg_data VARCHAR2(2000);
    l_order_line_id NUMBER;
    l_order_header_id NUMBER;
    xx_return_status VARCHAR2(1);
    xx_msg_count NUMBER;
    xx_msg_data VARCHAR2(2000);
    l_order_line ORDER_LINE_REC_TBL;
    l_createsr_rec SF_CSD_CREATEORDER_UTIL.CREATESR_REC;
    l_sr_notes_tbl cs_servicerequest_pub.notes_table;
    l_order_lines SF_CSD_CreateOrder.ORDER_LINE_REC_TBL;
    CURSOR c_get_rma(p_repair_line_id NUMBER) IS
    SELECT cpt.order_line_id,
    cpt.ORDER_HEADER_ID
    FROM csd_product_transactions cpt,
    csd_repairs cr
    WHERE cpt.repair_line_id=p_repair_line_id
    AND cr.repair_line_id= cpt.repair_line_id
    AND cpt.action_type='RMA';
    BEGIN
    -- Standard Start of API savepoint
    SAVEPOINT Create_Order;
    -- Standard call to check for call compatibility.
    IF NOT FND_API.Compatible_API_Call(l_api_version_number, p_api_version_number, l_api_name,G_PKG_NAME) THEN
    RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
    END IF;
    -- Initialize message list if p_init_msg_list is set to TRUE.
    IF FND_API.to_Boolean(p_init_msg_list) THEN
    FND_MSG_PUB.initialize;
    END IF;
    -- Initialize API return status to success
    x_return_status := FND_API.G_RET_STS_SUCCESS;
    -- call SF_CSD_CREATEORDER_UTIL.Create_SR
    -- this outputs incident_id (l_incident_id)
    l_createsr_rec.party_id :=p_order_rec.party_id;
    l_createsr_rec.cust_account_id :=p_order_rec.cust_account_id;
    SF_CSD_CREATEORDER_UTIL.create_sr (
    P_createsr_rec =>l_createsr_rec,
    P_sr_notes_tbl =>l_sr_notes_tbl,
    X_incident_id =>lx_incident_id,
    X_incident_number =>lx_incident_number,
    X_return_status =>lx_return_status,
    X_msg_count =>lx_msg_count,
    X_msg_data =>lx_msg_data
    l_incident_id :=lx_incident_id;
    FOR I IN l_order_line
    LOOP
    --- Use the incidentid returned by the above call (l_incident_id)
    -- Create RO
    l_createro_rec :=SF_CSD_CREATEORDER_UTIL.CREATERO_REC;
    l_createro_rec.INVENTORY_ITEM_ID :=p_order_lines.inventory_item_id;
    l_createro_rec.SERIAL_NUMBER :=p_order_lines.serial_number;
    l_createro_rec.PROBLEM_DESCRIPTION :=p_order_lines.PROBLEM_DESCRIPTION;
    SF_CSD_CREATEORDER_UTIL.create_ro (
    p_CREATERO_REC =>l_createro_rec,
    x_repair_line_id =>l_repair_line_id,
    x_repair_number =>l_repair_number,
    x_ro_status => xx_ro_status,
    x_return_status => xl_return_status,
    x_msg_count => xl_msg_count,
    x_msg_data =>xl_msg_data
    -- Call SF_CSD_CREATEORDER_UTIL.Create_repair_order
    --- This outputs repair line id.(l_repair_line_id)
    l_repair_line_id :=lx_repair_line_id;
    l_auto_rcv :=SF_CSD_CREATEORDER_UTIL.AUTORCV_REC;
    l_order_line_id :=null;
    l_order_header_id :=null;
    OPEN c_get_rma(l_auto_rcv.REPAIR_LINE_ID);
    FETCH c_get_rma INTO l_order_line_id, l_order_header_id;
    CLOSE c_get_rma;
    l_auto_rcv.REPAIR_LINE_ID :=l_repair_line_id;
    l_auto_rcv.ORDER_LINE_ID := l_order_line_id;
    l_auto_rcv.ORDER_HEADER_ID := l_order_header_id;
    SF_CSD_CREATEORDER_UTIL.auto_receive (
    p_autorcv_tbl => l_auto_rcv,
    x_return_status => xx_return_status,
    x_msg_count => xx_msg_count,
    x_msg_data => xx_msg_data );
    -- Get the order line id for the RMA created above. use query to select from csd_product_txns table.
    -- Select order_line_id from csd_product_txns where repair_line_Id = l_repair_line_id and action_type = 'RMA'
    --- Call SF_CSD_CREATEORDER_UTIL.Auto_receive to receive the item for the rma created above
    END LOOP;
    END;
    END SF_CSD_CreateOrder;
    Error(27,11): PLS-00323: subprogram or cursor 'CREATE_ORDER' is declared in a package specification and must be defined in the package body
    Error(52,91): PLS-00371: at most one declaration for 'G_PKG_NAME' is permitted
    Error(79,10): PLS-00456: item 'L_ORDER_LINE' is not a cursor

    The error message
    "subprogram or cursor 'CREATE_ORDER' is declared in a package specification and must be defined in the package body"
    Is telling you that the procedure you have coded in the package body is not in the header ... that means not just the name ... but the name and parameters. Compare them and find the discrepancy. They must match.

  • Error with PL/SQL code

    i am getting multiple errors when trying to insert data into a table through pl/sql declaration
    here are the errors:
    --Procedure to insert the values into section table(ex1.sql)
    declare
    v_section %type;
    begin
    v_section.SECTIONNO:=&no;
    v_section. DESCRIPTION:='&desc';
    v_section.SECTION_HEAD_EMPNO:=&empno
    insert into section values v_section;
    end;
    /When i execute the above pl/sql program i am getting errors:
    SQL> @ex1
    Enter value for no: 10
    old   4: v_section.SECTIONNO:=&no;
    new   4: v_section.SECTIONNO:=10;
    Enter value for desc: Sales
    old   5: v_section. DESCRIPTION:='&desc';
    new   5: v_section. DESCRIPTION:='Sales';
    Enter value for empno: 1005
    old   6: v_section.SECTION_HEAD_EMPNO:=&empno
    new   6: v_section.SECTION_HEAD_EMPNO:=1005
    v_section %type;
    ERROR at line 2:
    ORA-06550: line 2, column 12:
    PLS-00103: Encountered the symbol "%" when expecting one of the following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table LONG_ double ref
    char time timestamp interval date binary national character
    nchar
    The symbol "<an identifier>" was substituted for "%" to continue.
    ORA-06550: line 7, column 1:
    PLS-00103: Encountered the symbol "INSERT" when expecting one of the following:
    * & = - + ; < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like
    between || multiset member SUBMULTISET_
    The sBTW,*section* table is:
    SQL> desc section;
    Name                                                              Null?    Type
    SECTIONNO                                                         NOT NULL NUMBER(2)
    DESCRIPTION                                                                VARCHAR2(30)
    SECTION_HEAD_EMPNO                                                         NUMBER(4)Kindly,correct me where i am doing wrong
    Thanks in advance!!

    Hi,
    where is the semicolon after v_section.DESCRIPTION :=&empno ?
    ---it should be section%rowtype not simply %rowtype
    Just copy paste the below code. It will work.
    DECLARE
      v_section   SECTION%ROWTYPE;
    BEGIN
      v_section.SECTIONNO := &NO;
      v_section.DESCRIPTION := '&desc';
      v_section.SECTION_HEAD_EMPNO := &empno;
      INSERT INTO SECTION
      VALUES v_section;
    END;
    /Test
    SQL> CREATE TABLE SECTION
      2  (
      3    SECTIONNO            NUMBER (2) NOT NULL,
      4    DESCRIPTION          VARCHAR2 (30),
      5    SECTION_HEAD_EMPNO   NUMBER (4)
      6  );
    Table created.
    SQL> DECLARE
      2    v_section   SECTION%ROWTYPE;
      3  BEGIN
      4    v_section.SECTIONNO := &NO;
      5    v_section.DESCRIPTION := '&desc';
      6    v_section.SECTION_HEAD_EMPNO := &empno;
      7 
      8    INSERT INTO SECTION
      9    VALUES v_section;
    10  END;
    11  /
    Enter value for no: 10
    old   4:   v_section.SECTIONNO := &NO;
    new   4:   v_section.SECTIONNO := 10;
    Enter value for desc: sales
    old   5:   v_section.DESCRIPTION := '&desc';
    new   5:   v_section.DESCRIPTION := 'sales';
    Enter value for empno: 1005
    old   6:   v_section.SECTION_HEAD_EMPNO := &empno;
    new   6:   v_section.SECTION_HEAD_EMPNO := 1005;
    PL/SQL procedure successfully completed.
    SQL> select * from section;
    SECTIONNO DESCRIPTION                    SECTION_HEAD_EMPNO
            10 sales                                        1005
    SQL> G.
    Edited by: Ganesh Srivatsav on Apr 8, 2011 2:54 PM

  • Rectify the error in PL/SQL code

    CMW_BC_CALC_OF_FIN_YR_SDATE is a function which returns financial start date and CMW_BC_CALC_OF_FIN_YR_EDATE returns financial end date.
    I/P: 2004, 01-jan-2003
    O/P: A
    1 CREATE OR REPLACE FUNCTION CMW_BC_A_C_R
    2 (
    3 D IN VARCHAR2, RD IN DATE
    4 ) RETURN VARCHAR2 is
    5 SDATE DATE;
    6 EDATE DATE;
    7 TYPE VARCHAR2;
    8 BEGIN
    9 SDATE:=CMW_BC_CALC_OF_FIN_YR_SDATE(D);
    10 EDATE:=CMW_BC_CALC_OF_FIN_YR_EDATE(D);
    11 If RD<EDATE and RD>SDATE
    12 then TYPE:='C';
    13 end if;
    14 If RD>EDATE
    15 then TYPE:='A';
    16 end if;
    17 If RD<SDATE
    18 then TYPE:='R';
    19 end if;
    20 return(TYPE);
    21* END;
    SQL> /
    Warning: Function created with compilation errors.
    SQL> show error;
    Errors for FUNCTION CMW_BC_A_C_R:
    LINE/COL ERROR
    0/0 PL/SQL: Compilation unit analysis terminated
    4/11 PLS-00498: illegal use of a type before its declaration
    SQL>

    Hi,
    Use
    SELECT * FROM V$RESERVED_WORDS
    to know all the reserve words.
    Regards

  • ADO Object was Open error aka DB_E_OBJECTOPEN on Large Dataset in MS SQL 2012

    Hi I am running a query with a big result set in my Delphi application using tADOQuery.
    When I request 12 months data I get an error "Object was Open".
    But if I run the same query on 1 month of data it works fine.
    The mechanism I use to open all queries in my application is the same and has always worked for many years.  This is the first time I have hit this error.  My application has run thousands of different queries across many customer sites without ever
    hitting this error.
    In my research I found that this seems to correspond to an ADO Error DB_E_OBJECTOPEN.
    The 12 month query runs perfectly OK in SQL Mgmt Studio and takes about 1.5 minutes to start showing results.  But it is 4 minutes before it works out there are 3,810,979 rows.
    I am using a client cursor
    myADOQuery.CursorLocation:=clUseClient;
    And I am setting a large CommandTimeout = 600;
    So why does the query fail in the ADO client (but it works in SQL Mgmt Studio)?
    And what does this "Object was Open" error mean?

    Hi Justin,
    The below picture is the relationships between the Data Access component. ADO is based on OLEDB, the underlying provide is OLEDB.
    As you can see, ADO provider is based on OLE DB provider or ODBC Driver.
    And DB_E_OBJECTOPEN is the error you experence. It is returned by OLE DB provider (be it SQLOLEDB, SQLNCLI or any 3rd party provider) when it makes a call to ICommand::Execute without closing the result of the previous execution (see
    http://msdn.microsoft.com/en-us/library/ms718095(VS.85).aspx).
    Did anything change recently in your environment, a new version of the client application was deployed or client driver was upgraded?
    Usually this error occurs because of the problem in the client application, not the client provider. Application should do either of the following:
    Fully consume the result of the previous command execution prior to issuing a new command. If it doesn't, it might be leaking an object.
    If the result must be pending, it should turn set DBPROP_MULTIPLECONNECTIONS property to VARIANT_TRUE which will allow underlying OLE DB provider to establish additional connections under the hood. This must only be done if developer is absolutely sure
    that the application needs the previous result.
    Enable Multiple Active Result Sets on the connection which would allow running multiple queries on the same connection. This is also must be done consciously, as it may mask object leak.
    Besides, maybe you have known that the CommandTimeout is 30s by default. However, the reason that you can succeed when you use SSMS(SQL Server Management Studio) to run the query is because when using SSMS to create a new connetion,
    the commandTimeout is 0 by default. It means it has no limitation for the query command time.  But when you use ADO client to create a new connection to run the query, the time which is taken by the query may beyond the commandTimeout
    setting .So it failed to return the results in your ADO client.
    From a support perspective to further analize this issue is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support
    case with us. Visit this link to see the various support options that are available to better meet your needs: 
    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone."
    Keep us posted.

  • Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

    This was originally posted in the SSIS Forum, but a member of the IS team suggested it be moved here.  "Most recently I got this error (Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) so does this mean that SQL Server is still trying to use named pipes even if I only have TCP/IP enabled in SQL Server Configuration Manager?"
    I'm having the same issue, and here's our scenario:
    Installed SQL Server 2005 Developer Edition on a machine with WinXP SP2 and enabled remote connections over TCP/IP
    Installed SQL Server 2005 Standard Edition on a machine with Win2003 SP1 (remote connections over TCP/IP enabled by default)
    Attempted to 'Copy Database' from Developer Edition TO Standard Edition using 'Detach and Attach' method and recieved the error on the Win2003 machine: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
    Attempted to 'Copy Database' from Developer Edition TO Standard Edition using 'SQL Management Objects' method and recieved the error on the Win2003 machine: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
    Reinstalled Standard Edition on the Win2003 SP1 machine
    Checked all the settings on both machines several times, restarted services etc., and read every post I could find referencing the error.
    Same error
    Lost my last hair
    Thanks in advance,
    Steve

    Nan,
    Before I get on with this post - thank you for your reply.
    The XPSP2 machine actually had the firewall disabled, and I verified that it could accept connections on the the associated ports with the Shields Up utility.  I tested this on both machines.
    I can connect to the server from the XPSP2 machine, Import / Export, manage, view logs, and do everything EXCEPT get the Copy Database package to run.  SQL Server Agent always fails on the last step with the following error:
    Event Type: Error
    Event Source: SQLISPackage
    Event Category: None
    Event ID: 12550
    Date:  1/10/2006
    Time:  1:34:15 PM
    User:  NT AUTHORITY\SYSTEM
    Computer: 401SERVER
    Description:
      Event Name: OnError
     Message: Failed to connect to server BETHESDA.
    StackTrace:    at Microsoft.SqlServer.Management.Common.ConnectionManager.Connect()
       at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.OpenConnection(Server& server, ServerProperty serverProp)
    InnerException-->An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
    StackTrace:    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
       at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
       at Microsoft.SqlServer.Management.Common.ConnectionManager.InternalConnect(WindowsIdentity impersonatedIdentity)
       at Microsoft.SqlServer.Management.Common.ConnectionManager.Connect()
     Operator: NT AUTHORITY\SYSTEM
     Source Name: BETHESDA_401SERVER_Transfer Objects Task
     Source ID: {86F355AD-3B74-4D7B-8D2D-C743C790A269}
     Execution ID: {91B7C32C-C439-4EDB-8A0F-9F8BF207BC06}
     Start Time: 1/10/2006 1:34:15 PM
     End Time: 1/10/2006 1:34:15 PM
     Data Code: 0
    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
    Have you (or anyone else) successfully executed a Copy Databse task?
    Steve

  • PL/SQL leaves cursors open?

    I have been researching into what might look like a resource drain in an Oracle 7.3.4 database we have on a SCO OpenServevr 5.0.5 server.
    There are a couple of applications written in PRO*C (compiled on Solaris with Oracle 8.1.5) always running that keep connections open to the DB. All exchange of data between the apps and the db happens via calls to stored procedures.
    Examining the state of the connections, I noticed that the number of open cursors and UGA/PGA memory used seems to increase over time, and never stabilizes.
    I experimented a bit and noticed that even if I open a session via SQL/PLUS and call an extermely simple procedure that opens a cursors, fetches it, closes it and then commits, the cursor remains open until the session is closed (I examined the session with Toad and Enterprise manager - and cursor cache count is set to 0). Is the open cursor consuming resources (e.g. using precious ram of the SGA) even after the procedure is ended? And if so, how can I release a maximum of resources when my applications are idle, without having to close and reopen the session?
    Thanks, Gaetano Giunta

    If the open cursors are too many then
    ALTER SYSTEM SET CURSOR_SHARING = FORCE;
    Works only with oracle9i
    uv to set ur initparam CURSOR_SHARING=FORCE.
    Which will try using bind variables only.
    Check docs on cursor_sharing may be u may get fair idea on bringing down cursor openings....

  • Getting error while compiling this pl/sql code

    Hi,
    I am trying to execute the below block of pl/sql code and i encountering an error. i tried all possible combination of paranthesis and quotes. still giving error. can someone please help?
    IF inserting THEN
    pk_imdb_audit.p_ins_characteristic_a_t
    (in_'||rpad(column_name,35,' ')||'=> pk_imdb_audit.v_action_inserting,'
    WHEN max_col = column_id THEN
    in_'||rpad(column_name,35,' ')||'=> '||lower(in_col_value)||');'
    ELSE
    ' in_'||rpad(column_name,35,' ')||'=> '||lower(in_col_value)||','
    END text,
    table_name,
    column_id,
    2 disp_ord
    error snapshot:-
    ORA-06550: line 14, column 14:
    PLS-00103: Encountered the symbol "||rpad(column_name,35," when expecting one of the following:
    . ( ) , * @ % & | = - + < / > at in is mod remainder not
    range rem => .. <an exponent (**)> <> or != or ~= >= <= <>
    and or like LIKE2_ LIKE4_ LIKEC_ as between from using ||
    multiset member SUBMULTISET_
    The symbol "( was inserted before "||rpad(column_name,35," to continue.
    ORA-06550: line 15, column 13:
    PLS-00103: Encountered the symbol "WHEN" when expecting one of th

    Hi,
    here is a 'parseable' version of your query, but there is numerous ways to improve what you want to do (not sure even if the query is giving you what you're expecting from it):
    SELECT text
    FROM   (SELECT (CASE
                       WHEN min_col = max_col THEN    'CREATE OR REPLACE TRIGGER '
                                                   || SUBSTR(column_name,
                                                             1,
                                                             4
                                                   || 'aud
    AFTER INSERT
    OR UPDATE
    OF '
                                                   || column_name
                                                   || ',
    OR DELETE ON imdb.'
                                                   || table_name
                                                   || '
    FOR EACH ROW'
                       ELSE(CASE
                               WHEN min_col = column_id THEN    'CREATE OR REPLACE TRIGGER '
                                                             || SUBSTR(column_name,
                                                                       1,
                                                                       4
                                                             || 'aud
    AFTER INSERT
    OR UPDATE
    OF '
                                                             || column_name
                                                             || ','
                               ELSE(CASE
                                       WHEN max_col = column_id THEN    ' '
                                                                     || column_name
                                                                     || '
    OR DELETE ON imdb.'
                                                                     || table_name
                                                                     || '
    FOR EACH ROW'
                                       ELSE(CASE
                                               WHEN column_id IS NULL THEN    'CREATE OR REPLACE TRIGGER '
                                                                           || SUBSTR
                                                                                 (column_name,
                                                                                  1,
                                                                                  4
                                                                           || 'aud
    AFTER INSERT
    OR UPDATE
    OR DELETE ON imdb.'
                                                                           || table_name
                                               ELSE    ' '
                                                    || column_name
                                                    || ','
                                            END
                                    END
                            END
                    END
                   ) text,
                   table_name1 table_name,
                   column_id,
                   1 disp_ord
            FROM   (SELECT LOWER(REPLACE(column_name,
                                         'O_',
                                        )) column_name,                   /*changing O to O_*/
                           LOWER(REPLACE(t.table_name,
                                         '_A_',
                                        )) table_name,
                           LOWER(t.table_name) table_name1,
                           c.column_id,
                           MIN(column_id) OVER(PARTITION BY c.table_name) min_col,
                           MAX(column_id) OVER(PARTITION BY c.table_name) max_col
                    FROM   all_tab_columns c,
                           (SELECT object_name table_name
                            FROM   all_objects
                            WHERE  TRUNC(created) = TRUNC(SYSDATE)
                            AND    object_name = 'CHARACTERISTIC_A_T') t
    --AND object_name LIKE 'IMDB/_A/_%' ESCAPE '/') t /*commented this line for testing*/
                    WHERE  c.table_name(+) = t.table_name
                    AND    SUBSTR(column_name(+),
                                  1,
                                  2
                                 ) = 'O_'))
              /*changed the substring condition to match new changes*/
    UNION ALL
    SELECT (CASE
               WHEN min_col = column_id THEN    'DECLARE
    BEGIN
    IF inserting THEN
    pk_imdb_audit.p_ins_characteristic_a_t
    (in_'
                                             || RPAD(column_name,
                                                     35,
                                             || '=> pk_imdb_audit.v_action_inserting,'
               ELSE(CASE
                       WHEN max_col = column_id THEN    'in_'
                                                     || RPAD(column_name,
                                                             35,
                                                     || '=> '
                                                     || LOWER(in_col_value)
                                                     || ');'
                       ELSE    ' in_'
                            || RPAD(column_name,
                                    35,
                            || '=> '
                            || LOWER(in_col_value)
                            || ','
                    END
            END
           ) text /*,
           table_name,
           column_id,
           2 disp_ord*/
    FROM   (SELECT table_name,
                   column_name,
                   column_id,
                   min_col,
                   max_col,
                   in_col_value,
                   trg_header,
                      'in_'
                   || RPAD(column_name,
                           35,
                   || '=> '
                   || LOWER(in_col_value)
                   || ',' in_col
            FROM   (SELECT   LOWER(c.column_name) column_name,
                             LOWER(c.table_name) table_name,
                             c.column_id,
                             (CASE
                                 WHEN SUBSTR(column_name,
                                             1,
                                             2
                                            ) = 'N_' THEN
                                   /*changed the substring condition to match the new change*/
                                                            ':NEW.'
                                                         || REPLACE
                                                               (column_name,
                                                                'N_',
                                                                'N_'
                                            /*changed the condition to match new requirement*/
                                 WHEN SUBSTR(column_name,
                                             1,
                                             2
                                            ) = 'O_' THEN
                                   /*changed the substring condition to match the new change*/
                                                         'NULL'
                                 ELSE    ':NEW.'
                                      || REPLACE(column_name,
                                                 '_A_',
                              END
                             ) in_col_value,
                             LOWER(SUBSTR(column_name,
                                          1,
                                          3
                                         )) trg_header,
                             MIN(column_id) OVER(PARTITION BY c.table_name) min_col,
                             MAX(column_id) OVER(PARTITION BY c.table_name) max_col
                    FROM     all_tab_columns c
                    WHERE    c.table_name IN(
                                SELECT object_name
                                FROM   all_objects
                                WHERE  TRUNC(created) = TRUNC(SYSDATE)
                                AND    object_name = 'CHARACTERISTIC_A_T')
                    ORDER BY c.table_name,
                             c.column_id))

  • Maximum open Cursors Excedded error - for every transaction

    Hi All,
    I am getting the maximum opn cursors exceeded error suddenly for every single db transaction i am trying to make in my application. this did not happen previously during my developemnt and testing phase.
    I have a question here that i tried to google but failed to get satisfactory answer.:-
    When we use a cursor in the stored procedure to fetch data, how to make oracle automatically close the cursors once the stored proc finishes executin. Or is there something i have to follow other with my current open cursors limit to ensure this problem does not happen?
    Thanks,
    Chaitanya

    Hi Justin,
    My oracle stored procs are called by java framework. In each place i was closing the connection object but there were a few places where i was not closing the resultset object which directly pointed to my oracle cursor.
    I have closed the objects in such places and tried again but still i am getting the same error. Mit it be an instance where the oracle db is not allowing me to connect to it at all. Something like restarting it would help? Restarting the server where the oracle software is hosted.
    Please excuse my blatant ignorance in this issue.
    Thanks,
    Chaitanya

  • Named Pipes provider, error:40 could not open a connection to sql server. Only happens on one of the front end SRS servers

    when testing a datasource connection I get the following error.
    Named Pipes provider, error:40 could not open a connection to sql server.
    I've read all the posts on this and nothing works.  This is a scale out deployment and the connection
    works from the other server I have setup with SRS that is connected to the same backend SRS databases.  It just doesn't work from one of the SRS front ends.  I'm at a loss..  please help

    Enable both named pipe and TCP communications.
    Make sure client is using the same (named) pipe name as server for connection.
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Reporting Services 2008 R2 configuration error: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

    Hi, I am using SQL Server 2008 R2 and on one of our dev boxes I am trying to setup ReportServer using ReportingServices Configuration manager. This is was installed longtime back and during installation they created a service account for reporting services.
    When I try to configure the service account I do not get the service account created during the installation in the pull down and if I were to use something different I get this "Named Pipes Provider, error: 40 - Could not open a connection to SQL Server"
    error.
    Thanks in advance...........
    Ione

    Hi,
    Take a look at this blog - http://blogs.msdn.com/b/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx
    I hope it will help.

  • Re: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

    Hi,
    I'm encountering an issue with "Named Pipes Provider, error: 40 windows" and am having problems determining how to fix it due to the environment I'm using.  I have two SQL Servers installed on two separate Win2K3 Server boxes, one is SQL Server 2000 and the other is SQL Server 2005.  The SQL Server 2000 contains the actual application data.  The 2005 database is used only for Reporting Services.  I've set up the reports on SSRS such that their datasources hit the 2000 server.  This is using SQL Server authentication.
    When testing the reports via SSRS (in Visual Studio 2005), the connection to the data works and the reports are generated fine.  When I deploy them to the reporting server and launch IE to test locally (still on the 2005 box), I get this "Named Pipes Provider, error 40" issue.  I made sure that Named Pipes and TCP were enabled and the port set at 1433 (to match that on the 2000 box). 
    Now I changed the datasource's authentication from SQL Server to Windows authentication.  I tested this in SSRS and this works too.  When I redeployed the reports with this authentication change, testing the reports via IE locally (on the 2005 box) worked.  Great.  Now when I open IE on an external box, i.e. on the 2000 box, and try to test the reports, I get this same error 40 issue.  I've been through a few threads describing the error 40, fiddling around with the SQL Server configuration as well as SSRS, to no avail.  I have a feeling this error 40 issue has to due with permissions/authentication between the SQL Server boxes but I can't really be sure.  Anyone have any ideas on how to troubleshoot my situation.  Thanks.
    larry

    Named Pipes Provider, error: 40 - Could not open a connection to SQL Server :
    I.   Incorrect connection string, such as using SqlExpress.
    Check out: http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=558456&SiteID=17
                    https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1245564&SiteID=1
    The typical error when dealing with Express includes:
    a.  User is not aware of SqlExpress was installed as a named instance, consequently, in his/her connection string, he/she only specify ".","localhost" etc instead of ".\SqlExpress" or "<machinename>\Sqlexpress".
    b. Np was disabld by default after installing SqlExpress.
    c. If Sqlexpress was installed on the remote box, you need to enable remote connection for Express.
    Please read the following blog for best practice of connecting to SqlExpress.
    http://blogs.msdn.com/sql_protocols/archive/2006/03/23/558651.aspx
    II. Named Pipes(NP) was not enabled on the SQL instance.
    Check out: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=136253&SiteID=1
    Oppose to SQL 2000 which turn on all protocols, SQL 2005 SKUs turn off NP by default. So, when you see this error, please check:
    1) Go to SQL Server Configuration Manager, See Server has NP enabled.
    2) %windir%\program files\microsoft sql server\mssql.1\mssql\log, notepad ERRORLOG, see whether Server is listening on NP.  You should see "Server named pipe provider is ready to accept connection on [ \\.\pipe\sql\query ] or [\\.\pipe\mssql$<InstanceName>\sql\query]"
    3) Notice that "sql\query" is the default pipe name, so you need to know server is listening on which pipe name. eg: if you specify server pipe name is "sql\query1", then you would see in the errorlog that server listening on [ \\.\pipe\sql\query1 ], and go to SQL Server Configuration Manager, click client Named Pipe properties, see whether the pipe name is same with the one server listening on.
    4) If you are using SQL Native Client ODBC/OLEDB provider({SQL Native Client} or SQLNCLI), go to SQL Configuration Manager, click client protocols, make sure NP and TCP are both enabled. Right click properties of NP, make sure client is using the same pipe name as server for connection.
    5) If you are using MDAC ODBC/OLEDB({SQL Server} or SQLOLEDB) provider, in command line, launch "cliconfg.exe" and make sure NP enabled and right pipe name specified.
    III. Remote connection was not enabled. 
    Check out: when you right click on the Server in SQL Server Management Studio, in Connections, the Remote server connections part, you have enabled the "Allow remote connections to this server" check box
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=322792&SiteID=1
    https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=763875&SiteID=1
    If you are making a remote connection, namely, your target SQL Server is on the different box as client application, you might need to check whether:
    a. "File and Printer Sharing" was opened in Firewall exception list.
    b. Please see the blog for enabling remote connection for express and troubleshooting tips of remote connection.
    http://blogs.msdn.com/sql_protocols/archive/2005/11/14/492616.aspx
    http://blogs.msdn.com/sql_protocols/archive/2006/09/30/SQL-Server-2005-Remote-Connectivity-Issue-TroubleShooting.aspx
    IV. Server not started, or point to not a real server in your connection string.
    Check out: Open SQL Server Surface Area Configuration and ensure all the required services are started, Remote Connections are configured.
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=348662&SiteID=1
    a. use "sc query mssqlserver" for default instance or "sc query mssql$<instancename>" to make sure SQL Server was started. Sometimes, reseason behind the broken of your client application w/ this error:40 might be SQL server restarted and failed, so, it'd better for you to double check.
    b. User specified wrong server in their connection string, as described in the forum discussion, "MSSQLSERVER" is an invalid instance name. Remember, when you connect to default instance, <machinename> could be best representitive for the instance, when you connect to a named instance such as sqlexpress, you should specify <machinename>\<instancename> as data source in your connection string.
     V. Other reasons such as incorrect security context.
    Check out: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=192622&SiteID=1
    Such error also occured during user operation such as moving database or db mirroring or cluster, any DB OP that might invovle different sql instances, namely, the destination database is located in another sql instance and user is not aware of the state of the destination. I recommend you first isolate whether this fail is during connection stage or data operation stage.
    a. During data operation, you are normally asked to type in the destination server name whether it is default to "(local)" or another server "<remotemachinename>". So, remember the exact string that represent the target instance, then when the error repros, open command line, use "sqlcmd -S<representitive> -E" ,see what happens, if the connection fail, please follow up above I - IV troubleshooting lists. otherwise continue.
    b. If you can make basic conection, but still face the error, then there must be something that server reject the connection or client close the connection for some reason.
    VI. Please try basic connectivity tests between the two mahcines you are working on. One simple way to verifty connectivity is to use command line tools, such as osql.exe. For example, osql -E -Stcpervername\instancename. If it connects cross-machine successfully, please also verify that your connection string in your scenario is correct.
    Here are some blogs which could be helpful: just follow the basic connectivity troubleshooting guidelines on the SQL Protocols blog, see:
    SQL Server 2005 Connectivity Issue Troubleshoot - Part I
    http://blogs.msdn.com/sql_protocols/archive/2005/10/22/483684.aspx
    and
    SQL Server 2005 Connectivity Issue Troubleshoot - Part II
    http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx
    Hope this helps.

Maybe you are looking for

  • Adobe Acrobat 9.3.4 Update Question

    I just applied the update to take adobe acrobat from 9.3.3 to 9.3.4, but my Acrobat.exe didn't update to the correct version number.  Acrobat.dll did, as did the support info and the various registry keys went to 9.3.4.  Can someone provide some assi

  • Need help removing partition on macbook pro

    Hello I have a macbook pro 17" OSx 10.6.6 I have a partition that i am trying to remove. When I open up boot camp assistant and click continue then click i already have downloaded the windows support software to a cd dvd or external disk it tells me

  • N96 MMS problem (opening and deleting)

    Hello people.. I came here through the Dutch Nokia website, so i hope my english is good enough to understand.... This is my problem: this morning I recieved an MMS, and later on i send an MMS back. At that time, there was no problem opening the mess

  • Microsoft Online Store electronic D/L purchases do not provide a COA sticker?

      OK. Microsoft takes your money right away, sends you an email with your purchase information, and product key... but NO COA sticker anywhere?  How in the heck are you suppposed to come up with this?  What is the 'benefit' of this onlne electronic m

  • I have a ipod touch 3 generation with iso 4.2.1.  Model a1318  The update menu does not appear.

    I have an ipod touch 3rd generation Model A1318 32gb. How do I update an older iso 4.2.1 to a later version. the settings/general/update  menu does not display update.