Content Management and Capture

 View Only
  • 1.  Issue in closing ISRA Connection when running from Java standalone application

    Posted Fri August 02, 2024 03:03 AM

    Hi,

    I am writing the below standalone Java code to connect to IS and close the connection.

    The program is not stopping, and logons are getting created for every execution. Sysouts are printing "Connection Closed" message,still the connection is not closing.

    public void testConn()

    {

    ConnectionFactory fnConnFac = null;

    Connection fnConn = null;

    try {

    fnConnFac = createConnectionFactory(domain, productName);

    fnConn = createConn(fnConnFac, userName, password);

    if (fnConn == null)

    {

    System.out.println("Error - Obtained Connection is Null");

    }

    else

    {

    System.out.println("Info - Connection obtained");

    }

    System.out.println("closed Connection");

    }

    catch (Exception ex)

    {

    System.out.println("Error - Exception Occurred");

    ex.printStackTrace();

    }

    finally

    {

    try

    {

    if(fnConn != null)

    {

    fnConn.close();

    System.out.println("Connection closed");

    }

    }

    catch(Exception e)

    {

    e.printStackTrace();

    }

    }



    ------------------------------
    Saranya V
    ------------------------------


  • 2.  RE: Issue in closing ISRA Connection when running from Java standalone application

    IBM Champion
    Posted Mon August 05, 2024 04:54 AM

    Hi,

    it has been a (long) while, but I seem to remember that ISRA code is only supported in web app containers not standalone. Having said that we have created many standalone programs without problems.

    How are you determining that the connection is not closed?

    Kind regards,

    Gerold



    ------------------------------
    Gerold Krommer
    ------------------------------



  • 3.  RE: Issue in closing ISRA Connection when running from Java standalone application

    Posted Mon August 05, 2024 09:02 AM

    Hi Gerold,

    I can see multiple logons available in Xapex application with the user id I am using to connect to ISRA and I need to kill the logons when it reaches the maximum limit.



    ------------------------------
    Saranya V
    ------------------------------



  • 4.  RE: Issue in closing ISRA Connection when running from Java standalone application

    IBM Champion
    Posted Mon August 05, 2024 09:14 AM

    Hi,

    our code is hidiing something. createConnectionFactory and createConn are not part of the ISRA API.... so we cannot see what is really going on here.

    br,

    /Gerold

    PS: Are your repeatedly logging on with the same user? Those connections should be reused



    ------------------------------
    Gerold Krommer
    ------------------------------



  • 5.  RE: Issue in closing ISRA Connection when running from Java standalone application

    Posted Mon August 05, 2024 09:57 AM

    Below are the code for createConnectionFactory and createConn.

    private static ConnectionFactory createConnectionFactory(String strDomain, String strOrganization)

    throws FN_IS_ISException, ResourceException {

    FN_IS_SpiManagedConnectionFactory fnISSpiManagedConnectionFactory = new FN_IS_SpiManagedConnectionFactory();

    fnISSpiManagedConnectionFactory.setDomainName(strDomain); // domain

    fnISSpiManagedConnectionFactory.setOrganizationName(strOrganization); // organization

    fnISSpiManagedConnectionFactory.setProductName("IBM FileNet Image Services Resource Adapter"); // FILENET

    fnISSpiManagedConnectionFactory.setLogFileName("ISRA.log"); // logFileName

    fnISSpiManagedConnectionFactory.setLoggingLevel(2);

    fnISSpiManagedConnectionFactory.setLoggingMode(2);

    fnISSpiManagedConnectionFactory.setDeploymentInstance(1);

    return (ConnectionFactory) fnISSpiManagedConnectionFactory.createConnectionFactory();

    }

    private static Connection createConn(ConnectionFactory cnFac, String strUserID, String strPassword)

    throws FN_IS_ISException, ResourceException {

    FN_IS_CciConnectionSpec fnISCCICS = new FN_IS_CciConnectionSpec();

    fnISCCICS.setUserName(strUserID);

    fnISCCICS.setPassword(strPassword);

    fnISCCICS.setLoginType(0);

    return (Connection) cnFac.getConnection(fnISCCICS);

    }



    ------------------------------
    Saranya V
    ------------------------------