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.

Similar Messages

  • How to close JDBC client connections in JSP (9IDS Jdeveloper)

    Can anyone tell me how to close JDBC connections neatly through JSP in Oracle 9IDS Jdeveloper.
    I have a developer who has deployed a WAR file (comprising JSP page) to the Tomcat webserver.
    The page works fine except that it always leaves a JDBC client connection after the user closes the internet explorer window.
    I've tried using dead connection detection without success.
    At the operating system level, I have a script that can kill these sessions but I would prefer if theres some way the connection can be closed neatly through the JSP application.

    Hi:
    At database level you can:
    See CONNECT_TIME and IDLE_TIME options to CREATE/ALTER PROFILE
    Joao

  • Crystal report XI- JRC

    Hi All,
       I am using Crystal report XI with Java and Jboss4.0 and i am tryin to pull a report of around 90 pages. when i click on the report link it takes atleast 5 minutes to load the report and if i click on the last page button immediately after that i get the last page after 4 to 5 min after that i could navigate to any page in 2-4  seconds.
    I am not closing the ReportClient in my code will this be making the report to take long?
    secondly i get a wierd error,not all times but only when i try to click on any buton(next page ,export or lastpage button) consecutively for threee four times.The error says
    'couldnot retrieve data for subreport at this position'
    how can i overcome these issues. please help..
    thanks,
    prem

    Hello Prem,
    I'll continue to update your SDN post on this issue here:
    [Crystal Reports XI -JRC help needed|Crystal Reports XI -JRC help needed]
    This post migrated from Diamond.
    Sincerely,
    Ted Ueda

  • Wingdings not exported correctly in PDF by Crystal Reports XI JRC in Linux

    I have a report that contains checkmark and scissor character from Wingdings/Wingdings 2. The PDF file is generated via a program using Crystal Reports' Java Reporting Component. When I am testing it in my machine (Windows), the checkmark and scissors characters are shown correctly. But using our Linux Redhat server generates a "P" instead of the checkmark and a quotation mark instead of the scissors.
    With the thought that Crystal Reports XI JRC do font indexing instead of subsetting/embedding, my idea was that there was no installed Wingdings font in the Linux server. I've replicated the case in my Windows machine by removing the Wingdings font.
    With that knowledge, I've installed the Wingdings (*.ttf files) font in the Linux server and executed commands like ttmkfdir (as instructed in some tutorials). I've verified that in Applications -> Preference -> Fonts that the Wingdings fonts are selectable. But when I generated again my PDF file, the correct fonts are still not rendered correctly. Is there anything more I need to do for the JRC to recognize the Wingdings font in Linux.
    Migrating to the Crystal Reports for Eclipse released last Jan 2009 is not a possible option.

    First check is to ensure the Java JVM can see the font.  The Java SDK comes with the JFC demo Font2DTest.  Do the fonts show up there?
    Note that the Java JRE has a lib/fonts directory, where you can place TrueType fonts that the JRE then would use.
    Sincerely,
    Ted Ueda

  • How to use JDBC Connection Pools in a standalone application?

    Hi, there,
    I have a question about how to use JDBC Connection Pools in an application. I know well about connection pool itself, but I am not quite sure how to keep the pool management object alive all the time to avoid being destroyed by garbage collection.
    for example, at the website: http://www.developer.com/java/other/article.php/626291, there is a simple connection pool implementation. there are three classes:JDBCConnection, the application's gateway to the database; JDBCConnectionImpl, the real class/object to provide connection; and JDBCPool, the management class to manage connection pool composed by JDBCConnectionImpl. JDBCPool is designed by Singleton pattern to make sure only one instance. supposing there is only one client to use connection for many times, I guess it's ok because this client first needs instantiate JDBCPool and JDBCConnectionImpl and then will hold the reference to JDBCPool all the time. but how about many clients want to use this JDBCPool? supposing client1 finishes using JDBCPool and quits, then JDBCPool will be destroyed by garbage collection since there is no reference to it, also all the connections of JDBCConnectionImpl in this pool will be destroyed too. that means the next client needs recreate pool and connections! so my question is that if there is a way to keep pool management instance alive all the time to provide connection to any client at any time. I guess maybe I can set the pool management class as daemon thread to solve this problem, but I am not quite sure. besides, there is some other problems about daemon thread, for example, how to make sure there is only one daemon instance? how to quit it gracefully? because once the whole application quits, the daemon thread also quits by force. in that case, all the connections in the pool won't get chance to close.
    I know there is another solution by JNDI if we develop servlet application. Tomcat provides an easy way to setup JNDI database pooling source that is available to JSP and Servlet. but how about a standalone application? I mean there is no JNDI service provider. it seems a good solution to combine Commons DBCP with JNID or Apache's Naming (http://jakarta.apache.org/commons/dbcp/index.html). but still, I don't know how to keep pool management instance alive all the time. once we create a JNDI enviroment or naming, if it will save in the memory automatically all the time? or we must implement it as a daemon thread?
    any hint will be great apprieciated!
    Sam

    To my knoledge the pool management instance stays alive as long as the pool is alive. What you have to figure out is how to keep a reference to it if you need to later access it.

  • How to configure JDBC connection in oracle BI publisher with teradata datab

    Hi,
    I am going to use Oracle BI publisher to create report.
    Our database is Teradata.
    How to create database connection for Teradata in BI publisher.
    How to create JDBC connection.
    What should be the Database Driver Class?
    What should be the connection string format?
    Please provide me the suggetion.
    Thanks,
    Santanu Manna

    Hi;
    I suggest please refer below which could be helpful on your issue:
    How To Generate XML Output (Excel, HTML, PDF) for FSG Reports [ID 804913.1]
    E-XMLP: BI Publisher Report RTF Template to Excel output is not same as PDF,RTF or HTML format.[Article ID 1515711.1]
    BI Publisher Enterprise Excel Output File Size is Too Large [ID 1271544.1]
    Regard
    Helios

  • 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

  • How to create JDBC connection in J2ME with MS-SQL server?

    I need to have database connection in PDA with SQL server,as i am new to J2ME ,i dont know how to create jdbc connection on J2ME device.Please help me out with this problem........

    I need to have database connection in PDA with SQL server,as i am new to J2ME ,i dont know how to create jdbc connection on J2ME device.Please help me out with this problem........

  • 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.

  • Unable to close JDBC connection in crystal reports

    Hi,
    I have configured crystal reports to use a connection acquired from a datasource created in weblogic server to generate a report. I was hoping that by calling ReportClientDocument.close() i would be closing the connected used to generate the report but that doesnot seem to be the case. I run into a situation where all my connections from the connection pool are being held by the reports and therefore get an exception in the application.
    Can anyome please let me know if calling ReportClientDocument.close()  will ensure that the database connection used for generating the report is closed? If no, please let me know what needs to be done in the code to ensure that a connection acquired for generating a report is closed.
    Thanks in advance
    VAMSI

    Hi Sanjay,
    Once connected right click on the connection an try adding filtering. Check off all except Tables and if you still don't see anything try adding table filtering to see if they show up now.
    Thank you
    Don

  • How to pass BigDecimal as currecny to Crystal Reports using JRC 11

    Im using JRC to load and view crystal reports.ie loading crystal reports that are created (not by me) using Crystal Reports v 10. My work is just load those rpt files using JRC thick client.
    rpt files are bound to .mdb (MS Access) database and DB is password protected.  One of the table in database has currency data type. I'm creating a POJO class to implement the table structure. To match with Currency type, Im using BigDecimal type in my pojo class. when i open the .rpt file in crystal report designer, it shows with default currency symbol (i.e $ and  £) But the when i load the same report via JRC, It doesnot show the symbol at all.
    When I change this to String and pass symbol, it is coming up properly. But in some places, the reports use sum function of 2 curency fields. So in this case, string cannot be used.
    Any help would be appreciated.
    Thanks.

    Sorry. I did not get your point directly.
    So I'd recommend not directly relying on internal handling of BigDecimal. You can still report off the value.
    So you are telling me not to use BigDecimal? If not what should I use? Please be bit more explanative.
    Thanks.

  • XML in Crystal Reports...How to?

    Hello,
    I have created a report using Crytal report version 12.0.0.683, this report prompt the user to make three selections:
    1. Schedule Number
    2. Item Range - From Item To Item
    3. Location Range - From Location To Location.
    The report works great when i run it from within Crystal Reports, but my problem is running the report within the Manufacturing application that we have (MISys SBM). In Crystal Report I am able to see a drop down menu showing available data to select from based on the above parameters, but within the manufacturing application the prompt do come up but the drop down lists are blank. I have contacted the developer and they said that the values for the drops downs will not populate unless I create XML code for the report. Can someone offer some assistance? I hope I have been clear in my explanation....the developer does not provide support for reports we create.
    Thanks,
    b

    Hi JK,
    It's possible they don't support Crystal 11.0 or above. I believe what you are using is List Of Values. Previous versions did not support it and there are no API's to use them in older versions.
    In Business Objects Enterprise the LOV list is actually a report that is run. For stand alone CR it's saved in the RPT file so as a work around create a new report and use the same formula or selection you use in your main report and then select XML as the export type. This should generate the list of values you need in XML format. What you do with the XML file you'll have to check with the Developer.
    Thank you
    Don

  • Crystal Report That Uses Stored Procedure Errors when connecting to the DB

    We had developed reports a few years ago, including one that calls a Stored Procedure on an iSeries AS400 DB2 database.  We upgraded our environments to Crystal Reports 2008 and BO XI 3.1.  Now, the existing report that previously ran in the old environment is not running (note that the other SQL-based reports work without a problem, only this one which uses a store procedure is not working).  I downloaded the report into my local Crystal Reports designer and tried to run it from there and I got the following error message:
    ======
    Failed to retieve data from the database.
    Details: ADO Error Code: 0x
    Source Microsoft OLE DB Provider for ODBC Drivers
    Description: [IBM][iSeries Access ODBC Driver] Statement violates access rule:  Connection is set to read only.
    SQL State: 37000
    Native Error: [Database Vendor Code: 30186 ]
    ======
    {CALL "<database>"."<library>"."RELEASEDNOTINVOICE"({d '2010-03-01'})}
    This call will still work from on a SQL client running on a JDBC connection.  Is there some problem with the new verion of BO and Crystal Reports with using the iSeries ODBC driver?

    ...my issue was resolved by setting the ODBC.INI registry entry for AllowProcCalls from 0 to 1.

  • Crystal Reports hung on start up trying to connect to 204.50.113.148

    Yes, I am new to Crystal Reports. The software is installed on a machine with no access to the internet. When I start Crystal Reports 2008 it hangs up. I thiink it is trying to connect to SAP's servers at 204.50.113.148 to authenticate the product. Being that I have no internet connectivity, this is never going to happen. How can I get around this? Also I think this is going to be a problem when the client runs a report with the Crystal Reports Runtime Support installation.

    Hello,
    If you don't have a Developer Advantage Licensing agreement then you don't have rights to distribute the runtime. Each of your customers will have to purchase a copy of Crystal Reports to be licensed to run your application.
    See this [Licensing |http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/70bd6328-4128-2d10-7882-d7b95418dbaa]link for more info...
    Also can you explain why you and your users and software do not have access to the internet?
    For your personal use you can contact Our Sales team to get a License or registration number to stop the screen from asking to register.
    If you are an OEM Partner you can contact your account manager to provide you with a list of registration numbers.
    Thank you
    Don

  • Crystal report extremely slow after converting to SQL connection

    We have a VB application developed in Visual Studio 2005 that references:
    CrystalDecisions.CrystalReports.Engine v. 12.0.2000.0
    CrystalDecisions.Enterprise.Framework v. 12.0.1100.0
    CrystalDecisions.Enterprise.InfoStore v. 12.0.1100.0
    CrystalDecisions.ReportSource v. 12.0.2000.0
    CrystalDecisions.Shared v. 12.0.2000.0
    CrystalDecision.Windows.Forms v. 12.0.2000.0
    This application originally used ADO to connect to our SQL Server database.  I recently converted to a SQL connection so I can take advantage of table-valued parameters in SQL Server 2008.  After the conversion, some of our Crystal Reports now take up to 3 minutes to load, but only on some usersu2019 PCs.  Prior to the change, the reports only took a matter of seconds, and they still take only a matter of seconds on my development PC.  We have looked at all the settings we can think of on the slow PCs but so far have found no smoking gun.  Has anyone else experienced this issue?  Does anyone have any suggestions for how to find the problem?

    Hi Gina,
    Ah, that is why you are having problems. We had to fix CR so it would support MS SQL 2008. Not sure what version you are using but you need to install Service Pack 3 and then Fix Pack 3.5. Then CR will retain the SQLNCLI10 as it's data driver.
    And what I mean is once you update CR have your report writers open each report and set location to the new DSN or old DSN with the updated 10 driver and then verify the reports and save. This will update the RPT files so the 10 client is used.
    To get updated, and assuming you are on an early release the best way is to keep track of your keycode, uninstlal CR 2008 and then download CR SP 3 and FP 3.5:
    https://smpdl.sap-ag.de/~sapidp/012002523100009989492010E/cr2008_sp3_fullbuild.zip
    https://smpdl.sap-ag.de/~sapidp/012002523100006341722011E/cr2008fp35.exe
    If you are on SP 2 then you can use the incremental SP 3 and then FP 3.5
    https://smpdl.sap-ag.de/~sapidp/012002523100007123572010E/cr2008_sp3.exe
    Thank you
    Don

Maybe you are looking for