Skip to Content

I am using CRJavaHelper to display report on web but it’s not accessing alias of table.

I believe settablelocation is breaking the link so i need to use replaceconnection method instead

Can any help me with demo replaceconnection method code instead of my below current code.

try {

        String reportName = “test.rpt”;

       

       

       

        ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);

        if (clientDoc == null) {

            // Report can be opened from the relative location specified in the CRConfig.xml, or the report location

            // tag can be removed to open the reports as Java resources or using an absolute path

            // (absolute path not recommended for Web applications).

            clientDoc = new ReportClientDocument();

            clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);

            // Open report

            clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);

           

           

           

            // ****** BEGIN SET RUNTIME DATABASE CREDENTIALS ****************

            {

                String connectStr = PropertyLoader.getProperty(“DBURL”);

                String JNDIName = PropertyLoader.getProperty(“DB_POOL_NAME”);

                String driverName = PropertyLoader.getProperty(“DBDRIVER”);

                String userName = PropertyLoader.getProperty(“DBUSER”);    // TODO: Fill in database user

                String password = PropertyLoader.getProperty(“DBPASSWD”);    // TODO: Fill in valid password

                // Switch all tables on the main report and sub reports

                CRJavaHelper.changeDataSource(clientDoc, userName, password, connectStr, driverName, JNDIName);

                // logon to database

                CRJavaHelper.logonDataSource(clientDoc, userName, password);

            }

          

Thanks in Advance.

Vish

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. vishal tandel Post author

    Got solution. we can use crjavahelper only instead of replaceconnection method. Need to create views of that alias table on database and relinked it with the report tables.

    Closing this question

    Thanks Everyone

    Vish

    (0) 

Leave a Reply