B4J Library jCrystalReports Library

Hi all.
I would like to share this jCrystalReports Library. (For now it supports MS SQL JTDS, MS SQL SQLJDBC, MySQL, Oracle and SQLite) I think I'm wrong, the java code in this library doesn't restrict to any jdbc connection and you can configure any jdbc in crystal reports as long is in the classpath (step 3). Please test everything.
Steps:
1. Copy all jdbc libraries to "C:\Program Files (x86)\Business Objects\Common\3.5\java\lib" (optional) or you just can specify jars' path explained in step 3.
2. Copy all crystal report jars to your B4j additional libraries folder. Link
3. In the CRConfig.xml you need to add the jars locations to <Classpath> under <DataDriverCommon> section using same format as all other entries (use \ and / in the path).
4. Also you need to change <JavaDir> from the dafault location to your Java JRE or JDK bin folder (it has to be the 32bit one). For example mine is "C:\Program Files (x86)\Java\jre1.8.0_181\bin". I found on the internet that the default java directory from crystal reports is not working.
5. In the CRConfig.xml configure <JDBC> section, modifying the following fields
<JDBCURL></JDBCURL>
<JDBCClassName></JDBCClassName>
<JDBCUserName></JDBCUserName>
with the required strings.
Example:
<JDBCURL>jdbc:sqlite:C:/YourPath/mydatabase.db</JDBCURL>
<JDBCClassName>org.sqlite.JDBC</JDBCClassName>
<JDBCUserName></JDBCUserName> This field is optional if no username is needed.
6. Create a Crystal Report using JDBC as your data connection. (If you can't find JDBC (JNDI) in your connections use your Crystal Reports installation program to add that feature).
7. Create a B4J project and add the following in the #Region Project Attributes:
#AdditionalJar: CrystalCommon2
#AdditionalJar: DatabaseConnectors
8. Open the example to fill all variables and launch the report.

I attached the library files, an example and a copy of my CRConfig.xml located in "C:\Program Files (x86)\Business Objects\Common\3.5\java" (could be "\4.0\java") as an example of my configuration.

v1.00 - Release.
v1.01 - Added methods PrintReport and ExportReport.
 

Attachments

  • jCrystalReports1.00.zip
    11.9 KB · Views: 837
  • crystalreportstest.zip
    2.3 KB · Views: 848
  • CRConfig.xml
    5.3 KB · Views: 960
  • jCrystalReports-1.01.zip
    30 KB · Views: 915
Last edited:

roberto64

Active Member
Licensed User
Longtime User
I haven't heard any more news, even if you have done well with the crystal report libraries, if you want to share the jcrystalreports matrix to expand, let me know bye
 

Juan Marrero

Active Member
Licensed User
Longtime User
I haven't heard any more news, even if you have done well with the crystal report libraries, if you want to share the jcrystalreports matrix to expand, let me know bye
Sorry, I haven't got time to look into anything these days. To much work at home with a new house and a 10 month baby. Please understand. I can share the jCrystalReports eclipse project with you if you want.
 

BigBoss123

Member
Licensed User
Longtime User
Update,
I used MariaDB 10.5.4 and success, all step from @Juan Marrero and @kelvo01 works excellent for me.
I only use the latest version of the connector, either mariadb or mysql

Hi Roadee

That sound great.
I am trying to get this to work, and would appreciate if you could let me have the code you have used to get Crystal Reports and Mariadb to work.
Thanks ever for your help

David Donohue
 

roaddee

Member
Hi Roadee

That sound great.
I am trying to get this to work, and would appreciate if you could let me have the code you have used to get Crystal Reports and Mariadb to work.
Thanks ever for your help

David Donohue

I'll look for it first, because it's on my old laptop. I will share/reply soon on this forum.

Ikon Diverifikasi Komunitas
 
Hi Juan,
the crconfig.xml file to which folder should it be copied? inside the file there are references in the <classpath> tag to many files that are not present in the attachments on Google Drive to, where can I find them? Thank you,
Christian
 

Jose Rojas

Member
Licensed User
Hola, Juan,
el archivo crconfig.xml a qué carpeta se debe copiar? dentro del archivo hay referencias en la etiqueta <classpath> a muchos archivos que no están presentes en los archivos adjuntos en Google Drive, ¿dónde puedo encontrarlos? Gracias,
cristiano
Buanes Noches. Tienes Respuesta de esto? Tengo la misma duda.
 

Juan Marrero

Active Member
Licensed User
Longtime User
Hi Juan,
the crconfig.xml file to which folder should it be copied? inside the file there are references in the <classpath> tag to many files that are not present in the attachments on Google Drive to, where can I find them? Thank you,
Christian
Check the first post, last instructions before the released versions.
 
Hi Juan,
looking forward to trying to fix jasperreport issues, i'm attempting to use crystalreport (I had tried in the past but I didn't have time to continue testing)

I installed the XI version, I modified the CRConfig file and added all the libraries, but unfortunately it always gives me the same error:

"com.crystaldecisions.sdk.occa.report.lib.ReportSDKException---- Error code:-2147467259 Error code name:failed"

I tried many different connection strings (I think I understood from the web that the problem is inherent to the database connection) but it never returned a different error.


These are some of the many tried strings:
B4X:
    Dim cr As CrystalReports
    
    cr.REPORT_NAME = "C:\Users\*****\Desktop\crystalreportstest\Objects\rptCli.rpt"
    cr.USERNAME = "sa"
    cr.PASSWORD = "*******"
    cr.TRUSTED_CONN = "false" 'or "true"
    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2\sqlexpress:50511;encrypt=false;databaseName=PM2MXL;integratedSecurity=false;user=sa;password=*******"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2\\sqlexpress;user=sa;password=*******;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2\\sqlexpress:1433;user=sa;password=*******;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2:1433\\sqlexpress;user=sa;password=*******;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2\sqlexpress:1433;user=sa;password=*******;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2:1433;instance=SQLEXPRESS;user=sa;password=*******;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2:1433;instance=SQLEXPRESS;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2:1433;instance=SQLEXPRESS;encrypt=true;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2/sqlexpress:1433;encrypt=true;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2//sqlexpress:1433;encrypt=true;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2//sqlexpress;encrypt=true;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2//sqlexpress;encrypt=true;databaseName=PM2MXL;integratedSecurity=false;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2//sqlexpress;encrypt=false;databaseName=PM2MXL;integratedSecurity=false;"
    
    
    
    'cr.CONN_URL = "jdbc:jtds:sqlserver://<servername>:<port>"
    cr.DB_NAME = "PM2MXL"
    cr.DB_CLASS_NAME = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    cr.SERVER_NAME = "SQLEXPRESS"
    cr.LaunchReport


Do you have any string examples for SQL Server? Or is the error due to something else?

Thanks again for any help you can give me,
Christian
 

Juan Marrero

Active Member
Licensed User
Longtime User
Hi Juan,
looking forward to trying to fix jasperreport issues, i'm attempting to use crystalreport (I had tried in the past but I didn't have time to continue testing)

I installed the XI version, I modified the CRConfig file and added all the libraries, but unfortunately it always gives me the same error:

"com.crystaldecisions.sdk.occa.report.lib.ReportSDKException---- Error code:-2147467259 Error code name:failed"

I tried many different connection strings (I think I understood from the web that the problem is inherent to the database connection) but it never returned a different error.


These are some of the many tried strings:
B4X:
    Dim cr As CrystalReports
   
    cr.REPORT_NAME = "C:\Users\*****\Desktop\crystalreportstest\Objects\rptCli.rpt"
    cr.USERNAME = "sa"
    cr.PASSWORD = "*******"
    cr.TRUSTED_CONN = "false" 'or "true"
    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2\sqlexpress:50511;encrypt=false;databaseName=PM2MXL;integratedSecurity=false;user=sa;password=*******"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2\\sqlexpress;user=sa;password=*******;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2\\sqlexpress:1433;user=sa;password=*******;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2:1433\\sqlexpress;user=sa;password=*******;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2\sqlexpress:1433;user=sa;password=*******;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2:1433;instance=SQLEXPRESS;user=sa;password=*******;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2:1433;instance=SQLEXPRESS;encrypt=false;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2:1433;instance=SQLEXPRESS;encrypt=true;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2/sqlexpress:1433;encrypt=true;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2//sqlexpress:1433;encrypt=true;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2//sqlexpress;encrypt=true;databaseName=PM2MXL;integratedSecurity=true;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2//sqlexpress;encrypt=true;databaseName=PM2MXL;integratedSecurity=false;"
'    cr.CONN_URL="jdbc:sqlserver://192.168.xxx.2//sqlexpress;encrypt=false;databaseName=PM2MXL;integratedSecurity=false;"
   
   
   
    'cr.CONN_URL = "jdbc:jtds:sqlserver://<servername>:<port>"
    cr.DB_NAME = "PM2MXL"
    cr.DB_CLASS_NAME = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    cr.SERVER_NAME = "SQLEXPRESS"
    cr.LaunchReport


Do you have any string examples for SQL Server? Or is the error due to something else?

Thanks again for any help you can give me,
Christian
What sql server jdbc are you using? Microsoft's? Or the Open Source one?
 
Top