我在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();
}
}
答案 0 :(得分:0)
错误是指BusinessObject服务器上没有该报表的数据库驱动程序。我会检查你是否在Info View中得到了同样的错误,我猜你会这样。
要解决此问题,您需要验证报表连接使用的数据库类型是否正确,以及是否已为Business Objects安装了相关的数据源类型。