How to disconnect the database connection using crystal report

Post Author: cp_pramodu
CA Forum: Crystal Reports
Hi All,
We have developed an application using .Net and Crystal Reports 10 for generating Adhoc reports from Business system (db sybase 12). We are using the below mentioned script for opening rpt files.
Try
       ReportDocument1.Load(sReportName)
       For Each table In ReportDocument1.Database.Tables
              ' Get the TableLogOnInfo object.
              logonInfo = table.LogOnInfo
              ' Set the server or ODBC data source name, database name,
              ' user ID, and password.
              logonInfo.ConnectionInfo.ServerName = sReportServerName
              logonInfo.ConnectionInfo.DatabaseName = DBName
              logonInfo.ConnectionInfo.UserID = UserName
              logonInfo.ConnectionInfo.Password = Password
              ' Apply the connection information to the table.
             table.ApplyLogOnInfo(logonInfo)
Next
'Me.Cursor = Cursors.WaitCursor
Me.CrystalReportViewer1.ReportSource = ReportDocument1
'Me.Cursor = Cursors.Default
Catch ex As Exception
'Response.Write(ex.Message)
Finally
Me.Cursor = Cursors.Default
'ReportDocument1.Close()
'ReportDocument1.Dispose()
End Try
Each time user opens the report a new connection is established to the database, can we disconnect the connection established from crystal reports, while closing crystal report. At the same time i want to setup an Idle time for these connections. In database level, i will not be able to set idle time in database level, as it affect our electronic channels.
Waiting for a reply.
Thanks & Regards,
Pramodu. C. P

Hi,
If you are reworking the application can you not build in the functionality to re-establish a connection if there is a failure? That is, a submission from the application server to the database server detects a failure, etc. and then re-establishes the connection. If you need a more frequent check than during a user-initiated roundtrip, you may be best served by using the "dummy query" technique on some time interval.
From my understanding using HA Event Notification would require a RAC database (plus a multi-threaded application and services correctly configured on the RAC-side).
In the documentation I see this:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14250/oci09adv.htm#sthref1495
"Applications must connect to a RAC instance to enable HA event notification."
In any case, this has the potential to be a bit complicated...
Regards,
Mark

Similar Messages

  • How to check the database connection using OCI

    I am working on enhhancement of very old application developed using C and OCI. It has a background process which acts as a middleware for interaction of any other front end process with oracle database. Any processes, which needs to interact with database sends a request to background peocess and then it will execute a call to execute the stored procedures for performing requested operation (like select, update, insert) on table and will send the result back to respective process. So this process has to be always running in background and connected to branch database.
    If branch database gets restarted or connection gets dropped due to some ad-hoc problem then the background process also has to be restarted manually. Because this process establishes the connection to branch database only once on start up and it does not have the intelligence to reconnect automatically in such scenario.
    I am looking forward to build the intelligence in this process to automatically reconnect if connection with branch database is lost. But I am not familer with OCI, and I am not sure if there is any OCI call which can determine if my earlier connection is still available. Can any one please tell me if there is any other way to check the connection other than the execution of dummy query, then check if it gets executed properly and then do the actual query.
    Thanks in advance,
    Deeapk

    Hi,
    If you are reworking the application can you not build in the functionality to re-establish a connection if there is a failure? That is, a submission from the application server to the database server detects a failure, etc. and then re-establishes the connection. If you need a more frequent check than during a user-initiated roundtrip, you may be best served by using the "dummy query" technique on some time interval.
    From my understanding using HA Event Notification would require a RAC database (plus a multi-threaded application and services correctly configured on the RAC-side).
    In the documentation I see this:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14250/oci09adv.htm#sthref1495
    "Applications must connect to a RAC instance to enable HA event notification."
    In any case, this has the potential to be a bit complicated...
    Regards,
    Mark

  • How to view the History of a Crystal Reports iView in EP6?

    How to view the History of a Crystal Reports iView in EP6?
    Our Crystal reports are viewed via Crystal Enterprise and are both BW and non-BW Crystal reports.
    I have looked at the three supplied iViews from Business Objects (alert, folder and thumbnail) but I have only been able to access the last instance or run on demand a CR.
    Our users would prefer to see a listing of the past runs of the report and choose which report to view.  What parameters need set in the EP6 iView to see the history of a report?

    Hi Heather,
    it is correct that there is no sample iView that shows the History of Crystal Reports that are stored in Crystal Enterprise but there a sample codes on our web site and there are sample codes as part of the SDK documentation that show how to call the history and you should be able to take the code and create your own Java or ASP iView based on that.
    the link to our developer library :
    http://www.businessobjects.com/products/dev_zone/default.asp?intcmp=products12
    hope this helps
    Ingo

  • How many number of database connections used in a transaction

    Hi All,
    We are using weblogic 8.1 with Oracle 9i both running on windows 2000. We are trying to estimate the potential resource usage in the system we are building. As part of this activity we want to find out how the database connections are used for entity beans -
    If a session bean calls more than one entity beans
    (each method in the entity bean doing one update) does weblogic use the same database connection for all the entity beans or does it use seperate connections ? Is such behaviour documented somewhere ?
    Here the assumption is all the entity beans are linked to the same datasource.
    If the (default) behaviour is to use seperate connections is there a way to make it use one connection across multiple entity beans.
    Thanks
    Kingshuk

    Hi Bodapati,
    Sorry for the delay in replying to this.
    There is optimization, which will use the XA
    connections from the pool. Can you tell me what your
    observations are? I may be able to see if we can tune it.From our tests the XA driver too appear to make use of one connection only for the life of the transaction. There is a good document here explaining how it is ensured that only one connection is used - http://e-docs.bea.com/wls/docs81/oracle/trxjdbcx.html#1083132
    Quoting from the above URL :
    When a thread attempts to use a connection, the XA jDriver calls xa_open (and xa_start) to create the connection and associate it with the thread. After the database connection is created, the connection remains associated with the thread; the driver does not call xa_close. When the thread subsequently needs a database connection, it uses the same database connection associated with it, even though it appears to get and return a connection from the JDBC connection pool
    I am not sure why you say the connections will be
    blocked. One connection will be blocked only if you are > using non-XA driver to setup the pool, until the
    transaction commits. For XA there is no need to reserve
    the same connection for the transaction.Probably my understanding on this is incorrect and I need to read up. I was under the impression that - once a transaction begins, each connection used within that transaction, is enlisted as a part of that transaction and can not be used by in another transaction until the transaction commits or rollsback.
    Thanks
    Kingshuk

  • Save Database connection in crystal report

    We have build a crystal report that is saved in Business view manager. When we run the report from infoview, it always asks for database connection after we enter the parameters.
    How can we save the database connection details in crystal so that it never ask for database connection when running the report from infoview?
    I have a very little idea about business view manager and infoview. Thanks in advance for any help.

    Hi Stratos,
    We're having the same requirement: I want to store RPTs on BOE and execute them without having to login to the DB every time.
    Our BOE-Version: XI (12.3.0.601)
    Regards,
    Chrigu

  • Database Location using Crystal Report XI

    Crystal Report XI Developers Edition; VB 6 Enterprise Edition
    Prior to using Crystal Reports, I will create (if not already there) a database in my Visual Basic project file.
    Via Crystal Report XI, when I designed reports, I used Database Location as my project file where I stored a copy of the .mdb file.
    Prior to creating an "installaltion setup" package, I will create a Directory in Program Files. Let's use and example--I'll call the Directory in Program Files "Sports" so what I do is to copy the ".mdb" file to this directory and change the database location in the rpt files to "C:\Program Files\Sports".
    I have a question, in most install packages, the installer has the option to change the location of the setup files. Let's say installing my application, the user changes the directory. Therefore, the setup files (including the database) are not in "C:\Program Files\Sports" they are in "C:\Program Files\SomeOtherDirectory".
    QUESTION: How does Crystal Report know about this change? Remember in the design I setup the database location as ""C:\Program Files\Sports". Is there a way to tell CR where the database file is located (i.e. application path)?
    Thanks,
    Sam

    The Crystal Reports dlls must be in the correct Bin directory (depends on the version of CR used). You can not change this. If you are using a database such as Access mdb, you can set the report to look in it's own directory for the mdb database. If that is what will work for you, ensure that the report and the database file are in the same folder. let me know if you need more info on this.
    Ludek

  • How to enhance the Excel export from Crystal Reports

    Hello,
    I am new in Crystal Reports and I wonder if it is possible to enhance the Excel export from Crystal Reports with post-processing that would be applied to the Excel exported file.
    By example, is it possible to freeze the window panes, so rows and columns are frozen in place on the screen?
    Is there any possibility to obtain the file exported to excel to work with.
    Or maybe there is some ways to parametrize the Excel export from Crystal Reports?
    Any suggestions are welcomed.

    If you are using Crystal Reports 2008 you can use the Report Application SDK that is now available.
    It has a object called PrintOutputController that has an export method that allows you to get access to the exported file before you send it to the user.
    Check the Developer library and the samples for details.
    <a href="/blog/10">Rob&#39;s blog - http://diamond.businessobjects.com/robhorne</a>

  • 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 make common database connection using bean, etc.

    anyone know how to make a coomon database connection because on my web pages each of them need to connect on the database for their specific objectives... please help
    regards
    blingbling
    Edited by: BlingBling15 on Oct 22, 2007 1:16 PM

    Making a 'common' connection and passing it around is a bad idea. And making a new connection on every page, as you seem to have already guessed, also involves an overhead that you can do without.
    Like drvijayj2k2 has mentioned, you should use connection pooling.
    Take a look at the Apache Commons DBCP [1] and it's examples [2].
    [1] http://commons.apache.org/dbcp/
    [2] http://wiki.apache.org/jakarta-commons/DBCP
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • How to make new database connection using Oracle BI Interactive Dashboards

    Hi,
    I install Oracle BI Intelligence on my system.
    I am using Oracle BI Interactive Dashboard. Here we have default database connection.
    but now i want to use it for my own database. Can any body give me guideline how to
    make a new data base connection using this s/w or how to connect to my database so
    that i can make my own reports.
    I am using
    http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/saw/saw.html
    this link.
    i make odbc connection which is fine.
    but
    Restoring the Business Intelligence Presentation Catalog and Updating Metadata
    The third point blow above heading is not clear.
    Thanks

    Umesh - in order to build Answers and Dashboard content you must first setup a Physical model, then a Business model, followed by a Presentation Catalog/Subject Area.
    All these tasks are carried out using the Repository Administration Utility.
    1) Import your physical tables using OCI/ODBC into the physical layer.
    2) Build your model
    3) Deploy
    Then you're ready to start building answers/dashboards.
    Good Luck.

  • How to create a database connection using Jdeveloper 10g

    when i try to create a database connection,its asking for connection name.is that connection name is user-defined or predefined name??In the next step its asking for username and password.where do i get that username and password.if anyone know this please explain me in detail coz this is for the first time am using JDeveloper.
    Thanks in advance.

    Hi user583040,
    May be you could have a look on this: http://my.opera.com/Tiftif/blog/faq-jdeveloper-english §5.2. If you have suggestions to improve this document, i will greatly appreciate to add them to it.
    Regards,
    Tif

  • How to check the database existence using java.

    Hi All,
    I need to know if a database exists or not using DB2 sql statements. Is there any sql to find that.
    Thanks in advance

    try to connect to the database. if it is possible, the database exists - if not - well there may be a number of reasons, but if your database URL is correct, your network is ok and your database engine is running, the database is not existent.

  • Where/How to get the Virtual KPIs in Crystal Reports?

    hellooo!
    We are developing SSM7 reports using Crystal.
    And we have this example scenario:
    1. Two NONKPI variables defined via Cube Builder:
        NONKPI381_ACT/TAR  Net Sales         100000           
        NONKPI382_ACT/TAR  Expenses          80000
    2. Virtual KPI
        KPI380_ACT/TAR (Net Income Contribution) = (NONKPI381_ACT/TAR - NONKPI382_ACT/TAR)
    No issue in PAS and standard front-end reports as they show the KPI380 = 20000 (and other calculations) perfectly.
    However, we need a specific report showing an Objective and it's associated KPIs (e.g. KPI380*) and Initiatives. Apparently, the main FACT table CPMS_EA_DATA does not contain values for KPI380. I browsed all the CPMS tables but to no avail, I have not seen any relationships to at least calculate KPI380. Could somebody please give me some advise?
    Cheers and Thanks,
    Ron Almonte

    Hi there!
    If you are trying to read data directly from CPMS tables, then you won't find any measure data there. That data is stored in the Application Server... The CPMS_EA_DATA values there are only used as a datasource for the application server, those values are not used directly for the scorecard calculations.
    I would advise you to consider the upgrade to version 7.5. With this version you are able to use either Web Services or ODBO to connect SAP BusinessObjects Strategy Management to other SAP BusinessObjects tools.
    This way you will be able to easily access, for example, the details on the 'Context', 'Perspective', 'Objective', 'KPI' and 'Initiative', and to the respective measures 'Trend Status value', 'Status Value', 'Actual', 'Target' and 'Score'. You are also able to access more detailed information on the PAS model for any measure, so that you can build your reports on Web or CrystalI, your Dashboards on Xcelsius, etc, etc...
    I have used the ODBO provider (available starting with 7.5 SP2) to create a Universe, and then with QaaWS I was able to make that data available for Crystal, which made it very easy to built a report without any coding
    Hope this helps!
    Best regards,
    Ricardo Vieira
    Edited by: Ricardo Vieira on Oct 15, 2009 10:21 AM

  • Reg : How to get the company address in Crystal Report

    Dear members,
    I am stuck up with problem in Crystal Report in my project. I want to get the company address in the Crystal Report. How can i get the company address in the crystal report. Hope i will get help in this regard.
    Thank you.
    Regards,
    Venkatesh Rajagopalan

    Hi Dear
      plz send me  what is your methad to applay,
    so i am sending u code   for company address
    all company information  contain the OADM table ,
    so applay the select query  ang get the data form table
    this ia sample code ........
      SAPbobsCOM.Recordset oRecordset = (SAPbobsCOM.Recordset)ICreon_SBOAddOn.SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    string GetComp = "select * from OADM ";
                    oRecordset.DoQuery(GetComp);
                    strCompName = oRecordset.Fields.Item("CompnyName").Value.ToString().Trim();
       Use this code  u will find the company name
      and after  that pass this valu a parameter
    oRPT.SetParametervalue ("CompanyName", strCompanyName)
      so pass the strCompanyName  as a parameter in the  cdrystel report.
    hope  help this code ,
    if u have any problem so plz send me  question in form,
    if u r  satisfied my answer so pl give me rewards point,

  • How to configure jdbc/jndi connection in crystal report 10

    Post Author: effy
    CA Forum: Data Connectivity and SQL
    i have tried to configure jdbc/jndi connection , i have both
    drivers  data base side and  crystal report side but i
    can't  configure it.  so please help if u know
    something. 

    Sorry, but I'm not on a home pc, I'm working on a virtualized pc with a long chain of permissions ... so I cannot simply download and run an utility...
    Instead... I think (I WAS thinking) someone from SAP can tell me this info ... Probably I'll buy a paid assistance ticket... But really it's a strange thing that a simply connection from a (so) paid software need a so difficult problem solving routine..
    I edited my environment variales: JAVA, PATH; CLASSPATH; JAVA_DIR, and a long list of others ... to ALL point to ALL of directory containing used jars...
    .. I asked my SysAdmin to edit CrConfig.xml and it's done ... classpath are rights, jdbc infos are also ok, ...
    .. but none ...

Maybe you are looking for

  • Reader 11.0.10: won't save file open history.

    Adobe Reader 11.0.10 Windows shows a blank recently opened file list after it's closed and relaunched, every time, on the splash screen, the menu list, and on "View All".  100% repeatable.  AR 11.0.09 and before were fine, the problem started with th

  • Sorry no nothing about computers but can I transfer video films on my PC to my Ipad2 so that I can watch them on the IPad?

    I dont know a lot about computers so please go easy. I have videos stored on my Windows 7 PC. can they be transferred to my IPad2 so that I can watch them?

  • Restoring window layout

    Hey guys so I'm a new Premiere pro user and I was playing around with it when all my panels got screwed up.  Does anyone know how I can restore or reset the whole panel layout???  Thanks.

  • Name of server in a cluster

              IS there a way to get the name of the managed server in a cluster thats currently           servicing a request? I looked at the JMX API and couldnt find anything obvious           that would let me know the name of the server in a cluster

  • Bonjour Printer Problem

    I have a mostly-Apple environment but need to be able to print from a HP laptop running Windows XP Pro over an Airport Extreme wireless network. Someone at Apple send me Rendezvous for Windows, which worked fine. I replaced my Epson inkjet with a HP