刷新BO中的数据

发布于 2024-12-06 00:15:07 字数 4180 浏览 0 评论 0原文

我在 BO 中刷新报告时遇到错误。我要做的就是刷新 BO 中的报告并找到刷新所需的时间。一旦找到所有这些,我就必须将这些数据插入 MySQL 表中。

当我这样做时,我收到以下错误。

线程“main”中出现异常 com.businessobjects.rebean.wi.ServerException:发生数据库错误。数据库错误文本为:(CS)“DBDriver 无法加载:C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionServer\dbd_oci.dll(找不到指定的模块。 )”。(WIS 10901)

这是怎么造成的以及如何解决?

这是 BO 代码:

import java.util.Iterator;
import java.sql.*;



import com.businessobjects.rebean.wi.DocumentInstance;
import com.businessobjects.rebean.wi.ReportEngine;
import com.businessobjects.rebean.wi.ReportEngines;
import com.crystaldecisions.sdk.exception.SDKException;
import com.crystaldecisions.sdk.framework.CrystalEnterprise;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.framework.ISessionMgr;
import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
public class RefreshWebi {

    /**
     * @param args
     * @throws ClassNotFoundException 
     * @throws SQLException 
     */
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        // TODO Auto-generated method stub
        String cms="172.16.56.114";
        String username="administrator";
        String password="";
        String auth="secEnterprise";        
        String driver="com.mysql.jdbc.Driver";
        Connection conn;

        IEnterpriseSession enterpriseSession;

        System.out.println("success");

        Long currentTime;
        try {
            ISessionMgr sessionMgr=CrystalEnterprise.getSessionMgr();
            enterpriseSession=sessionMgr.logon(username, password,cms, auth);
            IInfoStore iStore=(IInfoStore)enterpriseSession.getService("InfoStore");    
            //bologger.entering("BOUtilities", "refreshWebIReport");
            IInfoObjects reportObjects = iStore.query("select top 1 * from ci_infoobjects where si_kind='webi'");

            ReportEngines reportEngines = (ReportEngines) enterpriseSession.getService("ReportEngines");
            ReportEngine reportEngine = reportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
            Iterator it = reportObjects.iterator();
            while (it.hasNext()) {
                IInfoObject reportObject = (IInfoObject) it.next();
                DocumentInstance documentInstance = reportEngine
                        .openDocument(reportObject.getID());

                currentTime = System.currentTimeMillis();

                documentInstance.refresh();
                System.out.println("Time taken to refresh "
                        + (System.currentTimeMillis() - currentTime) / 1000);
                documentInstance.closeDocument();
                int documentID = reportObject.getID();              
                String documentName=reportObject.getTitle();                
                long refreshtime=currentTime.intValue();
                long refreshDuration=(System.currentTimeMillis() - currentTime) / 1000;
                int refreshtimes=(int)refreshtime;              
                int refdur=(int)refreshDuration;
                System.out.println("Document id     :"+documentID);
                System.out.println("Document name     :"+documentName);
                System.out.println("Refreshtime   :"+refreshtimes);
                System.out.println("Refresh duration  :"+refdur);

                Class.forName(driver);
                conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "password");               
                Statement st=conn.createStatement();
                st.executeUpdate("insert into refreshtimings (documentid,documentname,refreshtime,refreshduration)values('"+documentID+"','"+documentName+"','"+refreshtimes+"','"+refdur+"')");
                conn.close();   

            }
            reportEngine.close();
            reportEngines.close();

        } catch (SDKException e) {
            e.printStackTrace();
        }
}

I am getting an error while refreshing the report in BO. What I have to do is to refresh a report in BO and find the refreshing time it taken for that. Once I find all these I have to insert those data in MySQL table.

While I am doing this I get the following error.

Exception in thread "main" com.businessobjects.rebean.wi.ServerException: A database error occured. The database error text is: (CS) "DBDriver failed to load : C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionServer\dbd_oci.dll (The specified module could not be found.
)" . (WIS 10901)

How is this caused and how can I solve it?

Here is the BO code:

import java.util.Iterator;
import java.sql.*;



import com.businessobjects.rebean.wi.DocumentInstance;
import com.businessobjects.rebean.wi.ReportEngine;
import com.businessobjects.rebean.wi.ReportEngines;
import com.crystaldecisions.sdk.exception.SDKException;
import com.crystaldecisions.sdk.framework.CrystalEnterprise;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.framework.ISessionMgr;
import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
public class RefreshWebi {

    /**
     * @param args
     * @throws ClassNotFoundException 
     * @throws SQLException 
     */
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        // TODO Auto-generated method stub
        String cms="172.16.56.114";
        String username="administrator";
        String password="";
        String auth="secEnterprise";        
        String driver="com.mysql.jdbc.Driver";
        Connection conn;

        IEnterpriseSession enterpriseSession;

        System.out.println("success");

        Long currentTime;
        try {
            ISessionMgr sessionMgr=CrystalEnterprise.getSessionMgr();
            enterpriseSession=sessionMgr.logon(username, password,cms, auth);
            IInfoStore iStore=(IInfoStore)enterpriseSession.getService("InfoStore");    
            //bologger.entering("BOUtilities", "refreshWebIReport");
            IInfoObjects reportObjects = iStore.query("select top 1 * from ci_infoobjects where si_kind='webi'");

            ReportEngines reportEngines = (ReportEngines) enterpriseSession.getService("ReportEngines");
            ReportEngine reportEngine = reportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
            Iterator it = reportObjects.iterator();
            while (it.hasNext()) {
                IInfoObject reportObject = (IInfoObject) it.next();
                DocumentInstance documentInstance = reportEngine
                        .openDocument(reportObject.getID());

                currentTime = System.currentTimeMillis();

                documentInstance.refresh();
                System.out.println("Time taken to refresh "
                        + (System.currentTimeMillis() - currentTime) / 1000);
                documentInstance.closeDocument();
                int documentID = reportObject.getID();              
                String documentName=reportObject.getTitle();                
                long refreshtime=currentTime.intValue();
                long refreshDuration=(System.currentTimeMillis() - currentTime) / 1000;
                int refreshtimes=(int)refreshtime;              
                int refdur=(int)refreshDuration;
                System.out.println("Document id     :"+documentID);
                System.out.println("Document name     :"+documentName);
                System.out.println("Refreshtime   :"+refreshtimes);
                System.out.println("Refresh duration  :"+refdur);

                Class.forName(driver);
                conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "password");               
                Statement st=conn.createStatement();
                st.executeUpdate("insert into refreshtimings (documentid,documentname,refreshtime,refreshduration)values('"+documentID+"','"+documentName+"','"+refreshtimes+"','"+refdur+"')");
                conn.close();   

            }
            reportEngine.close();
            reportEngines.close();

        } catch (SDKException e) {
            e.printStackTrace();
        }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼泪也成诗 2024-12-13 00:15:08

该错误是指该报告的数据库驱动程序在 Business Objects 服务器上不可用。我会检查一下您是否在信息视图中遇到相同的错误,我猜您会的。

要解决此问题,您需要验证报表连接使用的数据库类型是否正确,以及您是否已安装 Business Objects 的相关数据源类型。

The error is referring to the database driver for that report is not available on the Business Objects server. I would check to see if you get the same error inside Info View, I'm guessing that you will.

To resolve, you'll want to verify that the database type the report's connection is using is correct and that you have installed the relevant Data Source type for Business Objects.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文