cancel
Showing results for 
Search instead for 
Did you mean: 

Unexpected database connector error, error code -2147467259...

Former Member
0 Kudos

I am using CR4E 2 against an Oracle 10g db, invoking CR XI reports. Several of them have recently been getting an "unexpected database connector error. I cannot tell why I am getting this error; the jsp works for almost all the reports in the system, which posts an htp request to the jsp that contains the report filename and the parameters and data for the report file.

My question: What could cause this error, and what would prevent it?

The jsp code is below:


<%@page import="com.businessobjects.samples.CRJavaHelper,
com.crystaldecisions.report.web.viewer.CrystalReportViewer,
com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,
com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,
com.crystaldecisions.sdk.occa.report.data.*,
java.util.*,
java.text.*,
com.crystaldecisions.sdk.occa.report.application.ReportClientDocument"%>
	
	try {

		Object reportSource = null;

		String reportDesc = null;
		String reportFileName = null;

		if (!"CrystalViewer".equals(request.getParameter("CrystalEventTarget")) && !"CrystalViewer".equals(request.getParameter("CRVEventTarget")))
		    {//******************** Not postback; i.e. initial invocation from Maximo *************************
			//System.out.println("====== First pass - pre-postback ==========================");

			reportFileName = request.getParameter("reportFile").toString();
			session.setAttribute("reportFileName", reportFileName);

			ReportClientDocument clientDoc;
			clientDoc = new ReportClientDocument();
			clientDoc.open(reportFileName,OpenReportOptions._openAsReadOnly);
			//** log on to db - does it need to be done in common code?
			// ****** BEGIN LOGON TO DATASOURCE ****************  
			{
				String driverName = "oracle.jdbc.driver.OracleDriver";
				String JNDIName = "";
				String user_name = application.getInitParameter("user_name");

				String pw = application.getInitParameter("pw");

				String server_name = application.getInitParameter("server_name");
				String db_name = application.getInitParameter("db_name");

				String connectString = "jdbc:oracle:thin:@"	+ server_name.toString() 
				        				+ ":1521:" + db_name.toString();
				//Switch all tables on the main  and sub-report.  
				CRJavaHelper.changeDataSource(clientDoc, user_name, pw,	connectString, driverName, JNDIName);

				// logon to database
				CRJavaHelper.logonDataSource(clientDoc, user_name, pw);
			}
			// ****** END LOGON TO DATASOURCE **************** 		
			Iterator myIter = clientDoc.getDataDefController().getDataDefinition().getParameterFields().iterator();
			Field myField = null;
			String RptParamName = null;
			String ParamValue = null;
			while (myIter.hasNext()) {
				myField = (Field) myIter.next();

				RptParamName = myField.getName();
				//System.out.println("RptParam: " + RptParamName);
				//Is this parameter in the list? 
				if (request.getParameter(RptParamName) != null) {
					ParamValue = ((String) request.getParameter(RptParamName));
					// passes multiple values in the format value1,=value2,=valueN,...
					//so for an IN statement to work, the values should be in the format
					//"("+value1+"','"+value2...
					if (ParamValue.indexOf(",=") != -1)
					{
						ParamValue = "(" + ParamValue + ")";
					}
					ParamValue.replace(",=","','");
					
					CRJavaHelper.addDiscreteParameterValue(clientDoc,"",RptParamName, ParamValue);
				}
			} //end While			
			//System.out.println("====== connected parms ==========================");

			//** reportsource
			reportSource = clientDoc.getReportSource();
			session.setAttribute("ReportSource", reportSource);

			//** clean up
			clientDoc.close();

			//System.out.println("====== end of init logic (non-postback) ==========================");

		} else {//******************* postback *****************************************************************************

			reportFileName = session.getAttribute("reportFileName").toString();

			reportSource = session.getAttribute("ReportSource");
		}
		;
		//********************************* end init vs. postback logic **************************************
		//********************************* begin common code           **************************************

		{

			// >> Create the CrystalReportViewer object
			CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
			crystalReportPageViewer.setReportSource(reportSource);

			// set viewer attributes; this is where PDF vs. ActiveX would be set as well
			crystalReportPageViewer.setOwnPage(true);
			crystalReportPageViewer.setOwnForm(true);

			crystalReportPageViewer.setHasRefreshButton(true);
			crystalReportPageViewer.setEnableParameterPrompt(true);
			crystalReportPageViewer.setHasLogo(false);

			// Apply the viewer preference attributes
			crystalReportPageViewer.setEnableDrillDown(false);
            crystalReportPageViewer.removeDrillDownSubreportEventListener();

			// Process the report
			crystalReportPageViewer.processHttpRequest(request,response, application, null);
		}

	} catch (ReportSDKExceptionBase e) {
		System.out.println(e);
	}
%>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Does anyone have any input for this? It remains a problem & we have not found a solution.

Former Member
0 Kudos

Please ensure that you have upgraded to Service Pack 4. There was a bug related to Unexpected Database Connector error that was resolved in the latest service pack release this February.

Answers (0)