title: Refreshing Data in BO
body: <p>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.</p>
  
  <p>While I am doing this I get the following error.</p>
  
  <blockquote>
    <p>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)</p>
  </blockquote>
  
  <p>How is this caused and how can I solve it?</p>
  
  <p>Here is the BO code:                  </p>
  
  <pre><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();
          }
  }
  </code></pre>