B4J Question Using CrystalReport Library

enrique.fortin

Member
Licensed User
I am trying to use some reports that are already created in another application for my mobile applications.

my intention is to use a b4j application to create them and send them via mail.

I saw this library in the forum

but I can't get it to work, configure everything as explained in the steps.


Code to read the report:
Sub btnSimpleReport_Click
    Dim cr As CrystalReports
    
    cr.REPORT_NAME = "C:\Users\enrique.fortin\Desktop\ReportesHN\rptInstalacion.rpt"
    cr.USERNAME = "MyUserName"
    cr.PASSWORD = "MyPassword"
    cr.TRUSTED_CONN = "false" 'or "true"
    cr.CONN_URL = "jdbc:jtds:sqlserver://192.168.75.92:1433/DTKDBHN"
    cr.DB_NAME = "DTKDBHN"
    cr.DB_CLASS_NAME = "net.sourceforge.jtds.jdbc.Driver"
    cr.SERVER_NAME = "HN-VSR-SQL01"
    cr.LaunchReport
End Sub

this is the error I receive
WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
Waiting for debugger to connect...
Program started.
0 [JavaFX Application Thread] FATAL com.businessobjects.reports.sdk.JRCCommunicationAdapter - Request failed and JRC Command failed to be undone
1 [JavaFX Application Thread] ERROR com.businessobjects.reports.sdk.JRCCommunicationAdapter - detected an exception: Error inesperado de conector de base de datos
at com.crystaldecisions.reports.queryengine.Table.vc(SourceFile:2425)
at com.crystaldecisions.reports.dataengine.datafoundation.AddDatabaseTableCommand.new(SourceFile:529)
at com.crystaldecisions.reports.common.CommandManager.a(SourceFile:71)
at com.crystaldecisions.reports.common.Document.a(SourceFile:203)
at com.businessobjects.reports.sdk.requesthandler.f.a(SourceFile:175)
at com.businessobjects.reports.sdk.requesthandler.DatabaseRequestHandler.byte(SourceFile:1079)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1166)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:660)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:166)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:528)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:526)
at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:524)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:423)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:351)
at com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54)
at com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67)
at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716)
at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125)
at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537)
at com.crystaldecisions.sdk.occa.report.application.ds.a(SourceFile:186)
at com.crystaldecisions.sdk.occa.report.application.an.a(SourceFile:108)
at com.crystaldecisions.sdk.occa.report.application.b0.if(SourceFile:148)
at com.crystaldecisions.sdk.occa.report.application.b0.b(SourceFile:95)
at com.crystaldecisions.sdk.occa.report.application.bb.int(SourceFile:96)
at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.performDo(SourceFile:151)
at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.a(SourceFile:106)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:2159)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:543)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:3898)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.replaceConnection(SourceFile:3865)
at com.prusb.jCrystalReports.CrystalReports.LaunchReport(CrystalReports.java:184)
at b4j.example.main._btnsimplereport_click(main.java:190)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA$1.run(BA.java:236)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:832)
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Error inesperado de conector de base de datos---- Error code:-2147467259 Error code name:failed

I have already configured in crystal reports the file C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java\Config.xml for jtds.
and this is the configuration

<Classpath>C:\Program Files (x86)\SAP BusinessObjects\\SAP BusinessObjects Enterprise XI 4.0\java/lib/jtds-1.3.1.jar;

<JDBCURL>jdbc:jtds:sqlserver://192.168.75.92:1433/DTKDBHN</JDBCURL>
<JDBCClassName>net.sourceforge.jtds.jdbc.Driver</JDBCClassName>
<JDBCUserName>MyUserName</JDBCUserName>
I don't know what I'm doing wrong if someone already has an example with jtds or can see what I have wrong I would appreciate it.
 
Top