Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    3

    Unanswered: logical handle no longer valid exception

    I'm using WAS 5.0 and oracle 9i. I'm able to get my database through the pool connection. But i've a new problème. I can not have make change on my DB much than one time. After one commit i must restart my server to be able to modify something again. I have the following exception:

    java.sql.SQLException: logical handle no longer valid
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:269)
    at oracle.jdbc.driver.OracleConnection.checkPhyiscalS tatus(OracleConnection.java:753)
    at oracle.jdbc.driver.OracleConnection.privatePrepare Call(OracleConnection.java:1141)
    at oracle.jdbc.driver.OracleConnection.prepareCall(Or acleConnection.java:1055)
    at com.fidelia.extranet.entreprise.dossier.JDBCDossie rServiceImpl.validerPrestations(JDBCDossierService Impl.java:396)
    at com.fidelia.extranet.application.FIDELIAApplicatio nFacadeImpl.validerPrestations(FIDELIAApplicationF acadeImpl.java:508)
    at com.fidelia.extranet.client.websphere.struts.Valid erPrestationsAction.valider(ValiderPrestationsActi on.java:117)
    at java.lang.reflect.Method.invoke(Native Method)
    and this is my class :

    public int validerPrestations(int in_codePrestataire, Vector in_prestations) throws FonctionnelEntrepriseException, SystemEntrepriseException {
    /*Oracle*/ CallableStatement cstmt = null;
    // OracleConnectionProxy connProxy = null;
    //modif J3A
    OracleConnection oconn = null;

    int l_nbLignRet = 0;

    try {
    // Recuperation de la connexion
    // On recupere une PhysicalConnection sur la Connection, sinon on obtient
    // un ClassCastException dans le code du driver Oracle, a la creation
    // du StructDescriptor.

    /* OC
    connProxy = (OracleConnectionProxy) getConnection(ORACLE_FIDELIA_JDBC);
    conn = connProxy.getPhysicalConnection();
    */
    /* J3A
    conn = getConnection(ORACLE_FIDELIA_JDBC);*/

    /* modif J3A obtention de la connexion oracle par JNDI sinon impossible à partir de WAS5.0 pour non conformité
    des spécifications oracle jdbc2.0 avec specs de sun
    */
    // Object connection = null;
    InitialContext objInitialContext = new InitialContext();

    DataSource objDS = (DataSource) objInitialContext.lookup("jdbc/FIDELIAEXTRANET");
    Connection objCon = objDS.getConnection();
    oconn = (OracleConnection)WSJdbcUtil.getNativeConnection(( WSJdbcConnection)objCon);

    /* DataSource objDS = (DataSource) objInitialContext.lookup("jdbc/FIDELIAEXTRANET");
    Connection objCon = objDS.getConnection();
    OracleConnection oconn = (OracleConenction)WSJdbcUtil.getNativeConnection(( WSJdbcConnection)connection);
    */
    /*ArrayDescriptor alVarrayChar = ArrayDescriptor.createDescriptor("type_array", oconn );
    ARRAY queryCondition = new ARRAY(alVarrayChar, oc, conditionArray);*/



    // *** Creation du tableau de prestations a valider ***
    Struct[] prestations = new Struct[in_prestations.size()];
    // Descripteur de la structure Prestation
    StructDescriptor prestationDesc = StructDescriptor.createDescriptor("REC_VAL", oconn);
    // Parcours de la collection de prestations a valider
    Enumeration enum = in_prestations.elements();
    int i = 0;
    while (enum.hasMoreElements()) {
    // Creation d'une structure Prestation
    PrestationAValider l_prestation = (PrestationAValider) enum.nextElement();
    Object[] prestation_attributes = new Object[7];
    prestation_attributes[0] = new CHAR(l_prestation.getReferencePrestation(), CHARACTER_SET);
    prestation_attributes[1] = new NUMBER(l_prestation.getCoutReel());
    prestation_attributes[2] = new CHAR(l_prestation.getNumeroFacture(), CHARACTER_SET);// NO_FACT = numero facture
    prestation_attributes[3] = new CHAR(l_prestation.getMotif(), CHARACTER_SET);// CHOIX = motif
    prestation_attributes[4] = new CHAR(l_prestation.getCommentaire(), CHARACTER_SET);
    prestation_attributes[5] = new NUMBER(l_prestation.getComplementMotif());// NUM8 = complementMotif
    prestation_attributes[6] = new CHAR(l_prestation.getCodeValidation(), CHARACTER_SET);// ETAT = codeValidation
    Struct prestation = new STRUCT(prestationDesc, oconn, prestation_attributes);
    // Ajout de la structure au tableau des prestations a valider
    prestations[i] = prestation;
    i++;
    }

    // Description du tableau des prestations a valider
    ArrayDescriptor array_desc = ArrayDescriptor.createDescriptor("LISTE_VAL",oconn );

    Array array = new ARRAY(array_desc, oconn, prestations);

    // *** Construction de la query ***
    cstmt = (OracleCallableStatement) oconn.prepareCall(APPEL_TRAITELISTEVAL);
    cstmt.setInt(1, in_codePrestataire);
    cstmt.setInt(2, in_prestations.size());
    cstmt.setArray(3, array);
    cstmt.registerOutParameter(4, Types.CHAR);
    cstmt.registerOutParameter(5, Types.CHAR);
    cstmt.registerOutParameter(6, Types.INTEGER);

    // *** Execution de la procedure ***
    cstmt.execute();

    // *** Gestion des erreurs ***
    checkRetour("JDBCDossierServiceImpl.validerPrestat ions(" + in_codePrestataire + ")", cstmt.getString(4), cstmt.getString(5));

    // *** Lecture du resultat ***
    l_nbLignRet = cstmt.getInt(6);

    } catch (FonctionnelEntrepriseException e) {
    throw e;
    } catch (Exception e) {
    throw new SystemEntrepriseException("JDBCDossierServiceImpl. validerPrestations(" + in_codePrestataire + ") : [" + e.getMessage() + "]", e);
    } finally {
    // C'est le connProxy que l'on ferme, surtout pas la connexion physique !
    finalizeJDBC(cstmt, /*OC connProxy*/oconn);
    }

    return l_nbLignRet;
    }

    Can anyone help to fix that problem?

  2. #2
    Join Date
    Sep 2004
    Posts
    60

Posting Permissions

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