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:

Juan Marrero

Active Member
Licensed User
Longtime User
solved the first msg, now gives me another error, opens the press and then gives me an error "the size of the field can be a good thing -294.967, .294"
regards
I'm getting that error too. First when I was designing the report, if crystal can't read a field it errors. I only used readable fields to test. Then from B4J I'm getting the "size" error". Not solved it yet. Apparently is the connector. I'm downloading the latest one to test it.
 

roberto64

Active Member
Licensed User
Longtime User
hello, did you solve? how can I help you ?, by doing a test and going around the db and inserting a numeric field, I then finished putting a string and it gave me the same error.
regards
 

Juan Marrero

Active Member
Licensed User
Longtime User
hello, did you solve? how can I help you ?, by doing a test and going around the db and inserting a numeric field, I then finished putting a string and it gave me the same error.
regards
No I haven't. The problem is with Strings (TEXT. NVARCHAR(50), DATETIME). Same Jar file works with Jasper Reports library from B4J. When creating a crystal report if I use a formula like totext(some_field) and use the formula instead of the field directly and do a Preview, it works (not with DATETIME fields), but from B4J using Crystal Reports library it errors with the "size" thing. Crystal is definitely not liking text data types. Basically the library just use the specified jdbc, not like jJasperReports.jar that I had to specify different functions for each jdbc.
 

roberto64

Active Member
Licensed User
Longtime User
hello, it still doesn't resolve ?, because it doesn't reverse on Stimualsoft reports that more new.
regards
 

roberto64

Active Member
Licensed User
Longtime User
hello, can't it be solved? I can help you? It is interesting to have reports as crystal reports.
regards
 

roberto64

Active Member
Licensed User
Longtime User
A newer version?
I've only seen 2016, have you seen stimulreport, can you create a lib? Because it also works in Java.
Greetings
 

Juan Marrero

Active Member
Licensed User
Longtime User
A newer version?
I've only seen 2016, have you seen stimulreport, can you create a lib? Because it also works in Java.
Greetings
My Crystal Reports version is from 2011. I visited Stimulreport but I couldn't find a Jar file for their library. And I think is a paid software.
 

roberto64

Active Member
Licensed User
Longtime User
As for the crystal library, you can download the stimulus test because inside there are libraries for Java, or you need to see if V. S. 2019 Inside you will find more updated Crystal Reports.
 

roberto64

Active Member
Licensed User
Longtime User
Hi, I found new libraries for crystal reports and tytto works correctly, i would like to send libraries so you can try Sqlite data too, even a parameter search is possible? let me know how to send you these libraries, if it is possible to have the source code to have the library expanded.
regards
 

Juan Marrero

Active Member
Licensed User
Longtime User
Hi, I found new libraries for crystal reports and tytto works correctly, i would like to send libraries so you can try Sqlite data too, even a parameter search is possible? let me know how to send you these libraries, if it is possible to have the source code to have the library expanded.
regards
If you have dropbox or gdrive you can share it. I can share too the eclipse project.
 
Top