How to close ORMI connections after EJB lookup?

I am using an InitialContext to look up my EJBs, like this:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
env.put(Context.PROVIDER_URL, "ormi://localhost:23891/current-workspace-app");
env.put(Context.SECURITY_PRINCIPAL, username);
env.put(Context.SECURITY_CREDENTIALS, password);
ic = new InitialContext(env);
beanHome = (EJBHome)ic.lookup(beanHomeName);
ic.close();I have been testing this on JDeveloper 10.1.3 and the embedded OC4J.
This code gave me the problem that the user's credentials were only retireved once while the OC4J instance was alive. So if a user's permissions were changed, they would not be updated for EJB access.
I then found this document: Excessive ORMI Connections Created, which gave me a clue to use env.put("oracle.j2ee.rmi.loadBalance", "context");
However, I am concerned with the other part of that release note which states:
"Closing the context does not cause the connection to be closed. Doing this repeatedly will result in performance degredation."
Does anyone know how to forcibly close the ORMI connection that is created, or whether it will be released automatically?

the sample shows how to clear RAS and Enterprise resources after viewing report.
1. If you use unmanaged RAS - as I can see you using setReportAppServer, then remove the enterprise related stuff : instantiating and cleaning code.
The sample code is meant to give you an idea on how you can release the resources after done with viewing report. In your case all you need to do for cleaning is call close() on ReportDocumentObject. The sample will need to be modified for your requirements.

Similar Messages

  • When and How to close database connection in JSP?

    Hi there,
    I am using MySQL and JDBC 3.0, in my system, When and How to close database connection in JSP?
    Thanks in advance.
    Lonely Wolf
    <%@ page session="true" language="java" %>
    <jsp:include page="checkauthorization.jsp" />
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <%--
    Execute query, with wildcard characters added to the
    parameter values used in the search criteria
    --%>
    <sql:query var="availablecomputerList" dataSource="jdbc/Bookingcomputer" scope="request">
    SELECT * FROM computer where status=0
    order by s_code
    </sql:query>
    <html>
    <head>
    <title>Search Result</title>
    </head>
    <body bgcolor="white">
    <center>
    <form action="checkin.jsp" method="post">
    <input type="submit" value="Back to Check-in Page">
    </form>
    <c:choose>
    <c:when test="${availablecomputerList.rowCount == 0}">
    Sorry, no available computer found.
    </c:when>
    <c:otherwise>
    The following available computers were found:
    <table border="1">
    <th>Computer</th>
    <th>Description</th>
    <th>Status</th>
    <c:forEach items="${availablecomputerList.rows}" var="row">
    <tr>
    <td><c:out value="${row.s_code}" /></td>
    <td><c:out value="${row.description}" /></td>
    <td><c:out value="${row.status}" /></td>
    </tr>
    </c:forEach>
    </table>
    </c:otherwise>
    </c:choose>
    </center>
    </body>
    </html>

    when should you close the connection? when you're done with it.
    how should you close the connection? like this: conn.close();
    that said, doing this in a JSP page is bad form and not recommended
    JSP's typically don't contain ANY business or data logic

  • [IPhone SDK] How to close all pages after safari exit

    Apps close when you hit the home screen, however i find that Safari seems to keep multiple pages open even you close it , which no doubt uses memory. so does anyone know how to close these pages after safari exit ? Thanks very much.

    Does anyone know it , please give me some advises , thanks very much.

  • How to correct close database connection after report generation

    Hello
    I have problem a with alive database connection after report creation and report  closing. How to properly to close connection to database?
    Best regards
    Edited by: punkers84 on Jun 17, 2011 10:38 AM

    that's what I am doing... after viewing the report, I call the close method on the window closing event of the container window. but the connection is still open. I had a lot of other issues with my jdbc driver but after downgrading to an older version those issues are resolved.Only this one is still there! Is there any other way to close the connection (like using dbcontroller or etc.)?

  • How to close database connections in Crystal Reports

    I am using the following code to connect to database. I can either pass JNDIName or I can provide values for others by leaving JNDI name empty.
    If i use JNDI name, it will use a connection from the connection pool of App Server (in my case Weblogic), but it is not releasing the connection after use. Connection remains even if I logoff from the application. If i keep my max connections as 15 in weblogic, after clicking the page with crystal report 15 times all will remain active and users will not be able to login to the application.
    If i use connectionString and others without using JNDI Name, it directly connects to database. So it creates a connection in database server directly without using connection pool of weblogic. If i check weblogic, it shows no connection in use as expected, but if i check database, i can see the no. of connections increasing everytime a user clicks a crystal report page.
    When the connection touches the maximum allowed connection in server, every application using the same server goes down
    How can I close the connection which was created for the viewing the report?
    String reportName = "/reports/BankBalance.rpt";
    ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);
    if (clientDoc == null)
             clientDoc = new ReportClientDocument();
             clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);
            // Open report
            clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);
           String connectString = ""; // jdbc:sybase:Tds:DBSERVERNAME:9812/DBNAME?ServiceName=DBNAME
           String driverName = "";    // com.sybase.jdbc3.jdbc.SybDriver
           String JNDIName = "DS_APP";
           String userName = "";
           String password = "";
           // Switch all tables on the main report and sub reports
           CRJavaHelper.changeDataSource(clientDoc, userName, password, connectString, driverName, JNDIName);
         // logon to database
          CRJavaHelper.logonDataSource(clientDoc, userName, password);
    // Store the report document in session
    session.setAttribute(reportName, clientDoc);
                   // Create the CrystalReportViewer object
                          CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
         String reportSourceSessionKey = reportName+"ReportSource";
         Object reportSource = session.getAttribute(reportSourceSessionKey);
         if (reportSource == null)
              reportSource = clientDoc.getReportSource();
              session.setAttribute(reportSourceSessionKey, reportSource);
         //     set the reportsource property of the viewer
         crystalReportPageViewer.setReportSource(reportSource);
         crystalReportPageViewer.setHasRefreshButton(true);
         crystalReportPageViewer.setToolPanelViewType(CrToolPanelViewTypeEnum.none);
         // Process the report
         crystalReportPageViewer.processHttpRequest(request, response, application, null);

    the sample shows how to clear RAS and Enterprise resources after viewing report.
    1. If you use unmanaged RAS - as I can see you using setReportAppServer, then remove the enterprise related stuff : instantiating and cleaning code.
    The sample code is meant to give you an idea on how you can release the resources after done with viewing report. In your case all you need to do for cleaning is call close() on ReportDocumentObject. The sample will need to be modified for your requirements.

  • How to close database connections

    I am using the following code to connect to database. I can either pass JNDIName or I can provide values for others by leaving JNDI name empty.
    If i use JNDI name, it will use a connection from the connection pool of App Server (in my case Weblogic), but it is not releasing the connection after use. Connection remains even if I logoff from the application
    String reportName = "/reports/BankBalance.rpt";
    ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);
    if (clientDoc == null)
    clientDoc = new ReportClientDocument();
                   clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);
    // Store the report document in session
    session.setAttribute(reportName, clientDoc);
    String connectString = ""; // jdbc:sybase:Tds:DBSERVERNAME:9812/DBNAME?ServiceName=DBNAME
    String driverName = "";    // com.sybase.jdbc3.jdbc.SybDriver
    String JNDIName = "DS_APP";
    String userName = "";
    String password = "";
    CRJavaHelper.changeDataSource(clientDoc, userName, password, connectString, driverName, JNDIName);
    CRJavaHelper.logonDataSource(clientDoc, userName, password);
    // Store the report document in session
    session.setAttribute(reportName, clientDoc);
    // Process the report
    crystalReportPageViewer.processHttpRequest(request, response, application, null);

    the sample shows how to clear RAS and Enterprise resources after viewing report.
    1. If you use unmanaged RAS - as I can see you using setReportAppServer, then remove the enterprise related stuff : instantiating and cleaning code.
    The sample code is meant to give you an idea on how you can release the resources after done with viewing report. In your case all you need to do for cleaning is call close() on ReportDocumentObject. The sample will need to be modified for your requirements.

  • Router closes TCP connection after 30 minutes

    I have recently replaced my D-Link DIR-100 router with a Cisco Linksys RV042, but unfortunately there seems to be a problem with it.
    I have an external TCP connection coming in to a local service, and I therefore set up the router to redirect the incoming connection for the given port to the local PC hosting the service. This worked perfectly. I also opened the Firewall access rules to allow all data from WAN2 to be propagated through. This also worked just fine, and I can connect from the internet to the local PC, just like I could with my old router. Unfortunately this is where the simularities stop. When there is no communication on the TCP connection for more than 30 minutes then the router closes the connection automatically. This is NOT what I want. I only communicate on the TCP connection very rarely, but I do not want it closed automatically - at least not after just 30 minutes.
    I did some research on line and it appears that there in some routers are a TCP connection timeout, which in the router I read about, defaulted to 1 day. This would be OK. I experimented and found that if there is communication every 30 minutes then it is not close the connection, but if there is 50minutes between communication then it closes the connection.
    As I read that this timeout has to do with security I experimented with the firewall and found the following:
    1. Disabling the entire router firewall fixes the problem !!!
    2. Disabling just DoS has no effect (problem still exists)
    3. Disabling SPI means I cannot connect at all !!! (new and much worse problem)
    4. Disabling Block WAN Requests has no effect (problem still exists)
    Is there a way to solve this problem without disabling the entire firewall, as that is not what I want to do. I have the system set up for Dual WAN (load balancing), and I only want to allow connections to a handful of ports on the one WAN, and block the other WAN entirely.
    P.S. I was referred to the Cisco Small Business Support Community by the Cisco Home community, so I hope this is the right place.

    Hi Ddb101,
    This is a limitation (or feature depending on how you look at it) of the iPhone/iPod touch. 30 minutes after the device locks (usually 5 minutes of inactivity) the network turns off completely to save battery life. You can either turn autolock off globally, or some programs (mine for instance see: http://ootunes.com/app/ ) have an option that disables sleep while the app is running so the stream will keep playing... until your battery dies Only problem is with the screen on the battery actually dies even faster!
    Finally, if the device is connected to a constant power source, it shouldn't actually time out. So if you have a way to plug it in, it shouldn't quit after 30 minutes on you...
    hope that helps,
    also, since there's a link to my site up there, and I sell the app, I should tell you that I might get money if you go to the page and end up buying my app...

  • How to close RFC connection in one script coding

    In one script, I am using the REF command to call another 2 scripts and these called scripts shd be run on same C36 ( test system). I shd close RFC connection between these 2 scripts.
    That is , once the 1s script over the RFC shd be closed and the user has to give usename and pwd  then  2nd script shd run.
    I have tried with the following code…. But it says RFC is not open……
    REF ( Y04S_FC_RM_CJ88_112 , Y04S_FC_RM_CJ88_1 , C36_999 ).   (when execute this script RFC to C36 will be created and after execution that RFC shd be closed so I included following ABAP code)
    ABAP.
      data : dest type RFCDEST.
      move 'S4_SAPC36999' to dest.                                       
      move dest to v_dest.
    *--Close the connection before opening it incase it is opened
              call function 'RFC_CONNECTION_CLOSE'
                   exporting
                        destination          = dest
                   exceptions
                        destination_not_open = 1
                        others               = 2.
              if sy-subrc <> 0.
              endif.
              move sy-subrc to v_subrc.
    ENDABAP.
    REF ( Y04S_FC_RM_CJ44_112 , Y04S_FC_RM_CJ44_1 , C36_999 ). (here agagin the RFC will be created and this script will be exectued.)

    In one script, I am using the REF command to call another 2 scripts and these called scripts shd be run on same C36 ( test system). I shd close RFC connection between these 2 scripts.
    That is , once the 1s script over the RFC shd be closed and the user has to give usename and pwd  then  2nd script shd run.
    I have tried with the following code…. But it says RFC is not open……
    REF ( Y04S_FC_RM_CJ88_112 , Y04S_FC_RM_CJ88_1 , C36_999 ).   (when execute this script RFC to C36 will be created and after execution that RFC shd be closed so I included following ABAP code)
    ABAP.
      data : dest type RFCDEST.
      move 'S4_SAPC36999' to dest.                                       
      move dest to v_dest.
    *--Close the connection before opening it incase it is opened
              call function 'RFC_CONNECTION_CLOSE'
                   exporting
                        destination          = dest
                   exceptions
                        destination_not_open = 1
                        others               = 2.
              if sy-subrc <> 0.
              endif.
              move sy-subrc to v_subrc.
    ENDABAP.
    REF ( Y04S_FC_RM_CJ44_112 , Y04S_FC_RM_CJ44_1 , C36_999 ). (here agagin the RFC will be created and this script will be exectued.)

  • How to close timeout  connection in SQLDBC ?

    Hello,
    I use SQLDBC to access MAXDB 7.7.0.7.16 database, i have the following issue :
    When a connection reach timeout, I close the connection, and the release the connexion, and then I create a new connection
    To close connection I call my Disconnect function
                        The call close method return "Not connected", but It seems that the underlying Socket is not closed and the Database user task is not closed.
    So the number of task grow until it reach the maximun.
    Where is my error ?
    How can I be sure to close the database user task ?
    IDBError CMaxDBConnection::Disconnect()
         IDBError hr;
         if (m_pConnection)          
              EDPTRACE_DBG_INF(L"CMaxDBConnection::Disconnect %1", EDPMASK_TRC_CONNECTIONS) << (DWORD)m_pConnection;
              SQLDBC_Retcode rc = m_pConnection->close();
              if (SQLDBC_OK != rc)
                   hr = convertError(rc, m_pConnection->error(), L"CMaxDBConnection::Disconnect");               
              m_pParent->m_pEnvironment->releaseConnection(m_pConnection);
              m_pConnection = NULL;
         return hr;
    Regards
    Yann

    MAXDB 7.7.07.16 (WINDOWS 2008 R2 (64 bits) Client program in 32bits.
    Hello
    I have code a small program to illustrate my issue.
    When I create a connection with SQLDBC it create 2 user tasks in the MAXDB task Manager
    One uer task  APPPLICATION SERVER, SESSION TIMOUT, ... filled.
    T425  10 0x16AC User      2688* Command wait        823 0            76 20691065(s)
    and One User task with no session tiemout.
    T111   8 0x15B8 User       2688 Command wait       3009 0            76 24900501(s)
    T111                  USER             ( pid = 2688       ) -
    dispatcher_cnt: 2                                     command_cnt   : 2
    exclusive_cnt : 30                                    self_susp_cnt : 0
    state_vwait   : 0          state_vsleep  : 0          state_vsusp   : 0
    same_ukt_coll : 0        
    when I close the connection the task T111 is never remove !!
    Do you have any idea ?
    I try to delete environment but It does not work.
    Regards
    Yann.
    Here is the code  :
    // SQLDBC.cpp : Defines the entry point for the console application.
    #include "stdafx.h"
    #include "SQLDBC.h"
    using namespace SQLDBC;
    static void parseArgs(int argc, wchar_t **argv);
    static SQLDBC_Connection *connectDB();
    SQLDBC_Environment *g_env;
    typedef struct ConnectArgsT {
      bstrt username;
      bstrt password;
      bstrt dbname;  
      bstrt host;    
      bstrt request;    
    } ConnectArgsT;
    ConnectArgsT connectArgs;
    void exitOnError(SQLDBC_ErrorHndl &err);
    int _tmain(int argc, _TCHAR* argv[])
         SQLDBC_Retcode ret;
       parseArgs(argc, argv);
       for (int j = 0 ; j < 10 ; ++j)
            for (int i = 0 ; i < 100 ; ++ i)
                 SQLDBC_Connection *conn = connectDB();
                 ret = conn->close();
                 ret = conn->disconnect();
                 g_env->releaseConnection(conn);
            delete g_env;
            g_env = NULL;
       return 0;
    SQLDBC_Connection *connectDB()
      char errorText[200];
      SQLDBC_Retcode rc;
      if (g_env == NULL)
    Every application has to initialize the SQLDBC library by getting a
    reference to the ClientRuntime and calling the SQLDBC_Environment constructor.
           SQLDBC_IRuntime *runtime;      
           runtime = SQLDBC::GetClientRuntime(errorText, sizeof(errorText));
           if (!runtime) {
              fprintf(stderr, "Getting instance of the ClientRuntime failed %s\n", errorText);          
           g_env = new SQLDBC_Environment(runtime);      
    Create a new connection object and open a session to the database.
      SQLDBC_Connection *conn = g_env->createConnection();
      printf("Connecting to '%s' on '%s' as user '%s'\n",
             (char)connectArgs.dbname, (char)connectArgs.host, (char*)connectArgs.username);
      rc = conn->connect(connectArgs.host, connectArgs.dbname,
                         connectArgs.username, connectArgs.password);
      if(SQLDBC_OK != rc) {
        fprintf(stderr, "Can't connect to '%s'.\nERROR: %d:'%s'\n",
                connectArgs.dbname, conn->error().getErrorCode(), conn->error().getErrorText());
        exit(1);
         conn->setAutoCommit(SQLDBC_TRUE);
      return conn;
    static void parseArgs (int argc, wchar_t **argv)
      connectArgs.username = "ESKDBADM";
      connectArgs.password = "DELORME";
      connectArgs.dbname = "EDP350";
      connectArgs.host = "ly-delorme"; 
    void exitOnError(SQLDBC_ErrorHndl &err)
      if(err) {
        fprintf(stderr, "Execution stopped %d:'%s'", err.getErrorCode(), err.getErrorText());
        //exit(1);
    Yann.

  • How to close the object after generation Excel file

    I have generated excel file. I save that file using "Save" button on dialog-box. After i go to menu navigation at that time i got javascript error.
    please give me the solution how to close objects after generating excel file.

    Hi,
    Pls don't forget to reward points and close the question if you find the answers useful.
    Eddy

  • How to install Ciscom Connect after setting up the devise

    I have set up my router E1200 v2 with the disc after the direction through live chat as I received error code. Now my router works well but I don't have Ciscom Connect software in my program. I downloaded it from the site and saved it in my folder as an application. Now, how I can install it? As it is 'set up software', when I make it run, it tries to set up but the router has already been set up so it can't complete the setting-up then no software is saved as a program nor no 'ciscom' file is created.
    The software I downloaded was not the right one?
    I can enter Ciscom Connect page as I know the address for directly connection but still I would like to have one as a program which allow me to go to the CC easily.
    Let me know how to install CC software after setting up...
    Thank you! 

    Hello,
    Glad to heard that the issue had been resolved. And thanks for your sharing.
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here. 
    Fanny Liu
    TechNet Community Support

  • How to close browser window after user log out

    Hi,
    Does anyone know how I can close browser window after user logs out. The scenario is when user clicks a log out button I will invalidate user session and close the browser right away in the backing bean.
    Your help would be appreciated.

    Try run this and you'll see that it runs fine with no exceptions:
    <%
         String someText = "bla bla bla";
         response.setContentType("text/plain");
         response.setHeader("Content-Disposition", "attachment;filename=message.txt");
         try {
              ServletOutputStream os = response.getOutputStream();
              os.write(someText.getBytes());
              os.flush();
              os.close();
         } catch (Exception e) {
              out.println("ERROR: " + e);
    %>It looks like that after I've closed the outputStream I can't do any more processing in the JSP. Even if I remove the setContentType and setHeader methods it still behaves this way.
    I'm starting to think that there's no way around this...??

  • Can I close the connection after sending immediately on the server?

    I have a C/S program. On the server side, the process as following:
    1. accept (blocking)
    2. //a connection is established
    using a new socket to receive request data from client
    3. business processing ... (maybe several seconds)
    4. send response data to client
    5. close socket immediately
    6. listening continuely again
    The server side is running on linux and writed by Java, and client is running on windows and writed by C++ Builder.
    My problem is:
    1. if the server is running on windows, everything is OK.
    2. if the server is running on linux (that is exprcted), the client can not receive the response data from server, the client program said the connection is unavailable when he read from socket blockingly.
    3. if I add some delay, e.g. 500ms, between sending response and close the connection, the client can receive response normally.
    why above?
    thanks for help.
    Jack

    Sorry, long time to go away.
    package test.server;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class EchoServer {
         private int port; // listened port
         private ServerSocket ssock; // the server's ip
         public EchoServer(String host, int port) {
              this.port = port;
              // Create a ServerSocket
              try {
                   ssock = new ServerSocket(port);
                   SocketAddress addr = new InetSocketAddress(host, port);
                   ssock.bind(addr);
              } catch (Exception ex) {
                   ex.printStackTrace();
              new HandleThread().start();
         public class HandleThread extends Thread {
              public int ntohl(byte[] bytes, int offset) {
                   int length1 = ((((int) bytes[offset + 0]) << 24) & 0xff000000);
                   int length2 = ((((int) bytes[offset + 1]) << 16) & 0x00ff0000);
                   int length3 = ((((int) bytes[offset + 2]) << 8) & 0x0000ff00);
                   int length4 = ((((int) bytes[offset + 3]) << 0) & 0x000000ff);
                   return length1 + length2 + length3 + length4;
              public void run() {
                   InputStream in = null;
                   OutputStream out = null;
                   try {
                        while (true) {
                             System.out.println("Start Listening...  [" + port + "]");
                             Socket clisock = ssock.accept();
                             //clisock.setSoLinger(true, 1);
                             System.out.println( "SOLinger:" + clisock.getSoLinger());
                             try {
                                  System.out.println("Accepted Client Socket...  [" + clisock + "]");
                                  in = clisock.getInputStream();
                                  out = clisock.getOutputStream();
                                  // receive four bytes length
                                  byte[] lenbuff = new byte[4];
                                  in.read(lenbuff, 0, 4);
                                  int len = ntohl(lenbuff, 0);
                                  byte[] buff = new byte[len];
                                  in.read(buff, 0, len);
                                  System.out.println("Received length&#65306;" + len + "  " + new String(buff));
                                  Thread.sleep(1000);
                                  out.write(lenbuff);
                                  out.write(buff);
                                  out.flush();
                                  //Thread.sleep(500);
                                  System.out.println("Send finished&#12290;");
                             } catch (Exception ex) {
                                  ex.printStackTrace();
                             } finally {
                                  if (in != null) {
                                       try {
                                            in.close();
                                       } catch (Exception ex) {
                                  if (out != null) {
                                       try {
                                            out.close();
                                       } catch (Exception ex) {
                                  if (clisock != null) {
                                       try {
                                            long time00 = System.currentTimeMillis();
                                            clisock.close();
                                            System.out.println( "close socket&#65306;[" + (System.currentTimeMillis() - time00) + "]");
                                       } catch (Exception ex) {
                   } catch (Exception ex) {
                        ex.printStackTrace();
         public static void main(String[] args) throws Exception {
              if( args.length == 2 ) {
                   new EchoServer(args[0], Integer.parseInt(args[1]));
              } else if( args.length == 2 ) {
                   new EchoServer("127.0.0.1", Integer.parseInt(args[0]));
              } else {
                   new EchoServer("127.0.0.1", 16000);
    }In my application, the package is following:
    length(4bytes) + data
    I have a simple WinSocket Client, send data to this server and receive the response,the sending is OK, Server can receive all messages.But when client is ready to receive data, the winsock call return WSAECONNRESET(10054).
    If I uncomment "Thread.sleep(500);", it means wait some time before close socket, the client can receive all response data.
    why?

  • Crystal Reports's JRC. How to close JDBC connection?

    Hi!
    I have simple CR JRC application under Oracle AS 10.1.2.0.2, made from Crystal's sample codes.
    It works fine, but there is little problem: after closing vievwer's page JDBC connections stays alive.
    How can I close them?
    Here is my 2 jsp:
    ---------- Page1.jsp -----------------
    "<%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="com.crystaldecisions.reports.sdk.*" %>
    <%@page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
    <%@page import="com.crystaldecisions.report.web.viewer.*"%>
    <%
    // open the report rpt file
    String REPORT_NAME = "directs_q_d1.rpt";
    String Login =request.getParameter("p1");
    String Password =request.getParameter("p2");
    ReportClientDocument reportClientDoc = new ReportClientDocument();
    reportClientDoc.open(REPORT_NAME, 0);
    reportClientDoc.getDatabaseController().logon(Login,Password);
    ParameterFieldController paramFieldController = reportClientDoc.getDataDefController().getParameterFieldController();
    paramFieldController.setCurrentValue("", "reportname", new String("DIRECTS_QUARTERLY"));
    session.setAttribute("reportSource", reportClientDoc.getReportSource());
    reportClientDoc.close();
    response.sendRedirect("CrystalReportViewer.jsp");
    %>
    and
    ----------- CrystalReportViewer.jsp ------------------------
    <%//Crystal Report Viewer imports.%>
    <%@page import="com.crystaldecisions.report.web.viewer.*"%>
    <%@page import="com.crystaldecisions.reports.sdk.*" %>
    <%
    //Refer to the Viewers SDK in the Java Developer Documentation for more information on using the CrystalReportViewer
    //API.
    CrystalReportViewer viewer = new CrystalReportViewer();
    viewer.setOwnPage(true);
    viewer.setOwnForm(true);
    viewer.setPrintMode(CrPrintMode.ACTIVEX);
    viewer.setHasRefreshButton(false);
    viewer.setEnableDrillDown(false);
    viewer.setDisplayGroupTree(false);
    viewer.setHasToggleGroupTreeButton(false);
    viewer.setHasViewList(false);
    viewer.setHasLogo(false);
    //Get the report source object that this viewer will be displaying.
    Object reportSource = session.getAttribute("reportSource");
    viewer.setReportSource(reportSource);
    //Render the report.
    viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
    viewer.dispose();
    %>
    -------------------------------------

    Oh, i'm sorry :) It was a "time-out" tag in CRconfig.xml. Tipic closed.

  • How to Close InfoPath Form After Submission When Two Buttons Exist?

    I have an browser-enabled InfoPath 2010 form that has two views and a submit button on each view. The form would correctly submit and close the form using one button on the form until the second button was added. After adding the submit button on a second
    view, the second button submitted/closed but the behavior on the first view changed so that the form no longer closes after submission. I’ve researched this and have not yet found a solution to allow closing the form after submission for one of the buttons.
    Things I’ve tried:
     - I’ve attempted creating multiple submit data connections for the different buttons
     - Specifying different Submit Options
     - Try closing the form with the code
     - Add another button to the non-closing view
     - Add duplicate Rule actions to "Close this form: No Prompt"
    Settings:
    Button rules:
     - Submit using data connection: SharePoint Library Submit
     - Close this form: No Prompt
    Button Properties:
     - Action > Rules and Custom Code
    The form Submit Options:
     - Send form to a single destination (a form library)
     - Choose a data connection for submit (SharePoint library submit)
     - Advanced > After Submit: Close the form
    Advanced form options:
     - Filler Features: all items unchecked (not allowing Save, etc.)
     - E-Mail Attachments: uncheck Enable InfoPath e-mail form functionality for this form template
    Resources:
    When considering programmatically submitting and closing the form, I understand from this article that the Rules run before code and I can’t close the InfoPath form programmatically by writing code behind a button that has a rule set on it:
    http://www.bizsupportonline.net/blog/2009/01/how-to-programmatically-run-code-close-infopath-web-form/
    Discussion of creating a custom Save and Submit buttons for InfoPath browser forms:
    http://markhaverty.com/sharepoint/custom-save-and-submit-buttons-for-infopath-browser-forms/

    what if you need to switch views? 
    I have the same problem in a similar situation.  I created a test button to narrow down the cause.  the button submits data & closes the form fine.  however when I add a rule to switch views before the submit & close rule, it
    breaks.  Submit still works but it no longer closes the form.  If I disable the switch-view rule, then it closes fine. 
    I tried added another rule to switch back to the main view but that didn't help. 
    switching views is an integral part of the workflow b/c I want to email the alternate view upon approval & then close the form.  So removing that rule is not a good answer unfortunately. 

Maybe you are looking for