Symptom
- How to configure a JDBC connection?
- How to create a report using a JDBC connection in Crystal Reports?
- How to configure the crconfig.xml file to connect to a database using a JDBC connection in Crystal Reports?
- Note: Images, video, and data in this SAP Knowledge Base Article is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
Environment
- SAP Crystal Reports 2013
- SAP Crystal Reports 2016
- SAP Crystal Reports 2020
Resolution
- To connect to a database using a JDBC connection in Crystal Reports:
- First confirm a JDBC connection to your database is supported for the version of Crystal Reports used, by looking at the Supported Platforms document:
2859510 - Supported Platforms documents for Crystal Reports
- Download a supported JDBC driver from your database vendor website.
- Install the JDBC driver to the default path, or copy the JDBC driver .jar file to a folder of your choice. For example: C:\Database Name\JDBC Driver
- Add the path of the JDBC driver .jar file, to the classpath of the Crystal Reports configuration file: crconfig.xml:
- 4.1 Navigate to the following folder:
C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java
Note: This is the default installation folder, if you installed Crystal Reports in a custom location, the start of the path will be different.
- 4.2 Open in a Text Editor the file: crconfig.xml
- 4.3 Under the section: <DataDriverCommon>, add the path and the name of the JDBC .jar file to the section: <Classpath>
<DataDriverCommon>
<JavaDir32>C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\sapjvm/bin</JavaDir32>
<JavaDir64>C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win64_x64\sapjvm\bin</JavaDir64>
<Classpath><INSERT YOUR .JAR FILE PATH & NAME HERE>;C:\MS SQL Server JDBC\sqljdbc_6.0\sqljdbc42.jar</Classpath>
<UseProxy>FALSE</UseProxy>
<ProxyAddress></ProxyAddress>
<ProxyPort></ProxyPort>
</DataDriverCommon>
For example:
If the JDBC Driver .jar file for your database is: DatabaseJDBC.jar
and it is located in: C:\Database Name\JDBC Driver
Then add the path and .jar file to the Classpath section, like:
<DataDriverCommon>
<JavaDir32>C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\sapjvm/bin</JavaDir32>
<JavaDir64>C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win64_x64\sapjvm\bin</JavaDir64>
<Classpath>C:\Database Name\JDBC Driver\DatabaseJDBC.jar;C:\MS SQL Server JDBC\sqljdbc_6.0\sqljdbc42.jar</Classpath>
<UseProxy>FALSE</UseProxy>
<ProxyAddress></ProxyAddress>
<ProxyPort></ProxyPort>
</DataDriverCommon>
- 4.4 Save the change made in the file: crconfig.xml
- Start Crystal Reports, and create a new report. ( Under the menu "File" select "New – Blank Report" )
- In the "Database Expert", under "Create New Connection", double click on: JDBC (JNDI)
- In the JDBC (JNDI) window, enter the following information, corresponding to the database and JDBC driver used.
- Connection URL
- Database Classname
Important Note: Consult your Database documentation, or Database Administrator to obtain the Connection URL, and Database Classname.
For you convenience, the following table contains connection URL for different database:
Database Connection URL Database Classname DB2 jdbc:db2://<server name>:<port number>/<database name> com.ibm.db2.jcc.DB2Driver Derby jdbc:derby://<host name>:<port number>/<database name>;create=true org.apache.derby.jdbc.EmbeddedDriver HANA jdbc:sap://<server server>:<port number> com.sap.db.jdbc.Driver Informix jdbc:informix-sqli://<host name>:<port number>/<database name>:INFORMIXSERVER=<server name> com.informix.jdbc.IfxDriver MS SQL Server jdbc:sqlserver://<server name>:[port number] com.microsoft.sqlserver.jdbc.SQLServerDriver MySQL jdbc:mysql://<server name>:[port number]/<database name> com.mysql.jdbc.Driver Oracle jdbc:oracle:thin:@<server name>:[port number]:<service name> oracle.jdbc.driver.OracleDriver PostgreSQL jdbc:postgresql://<server name>:[port number]/<database name> org.postgresql.Driver Sybase jdbc:datadirect:sybase://<server name>:<port number>; databaseName=<database name> com.ddtek.jdbc.sybase.SybaseDriver Sybase TDS jdbc:sybase:Tds:<server name>:<port number>?ServiceName=<TDS service name> com.sybase.jdbc4.jdbc.SybDriver ODBC jdbc:odbc:DSN-name sun.jdbc.odbc.JdbcOdbcDriver
- Click Next, and enter your database user name and password.
- Video demonstrating how to create a JDBC connection to a database in Crystal Reports:
Media not computed.
Keywords
Crystal Reports, XI R2/XI, JDBC Connectivity, JRC, CRJ, JDBC Connection, CR, Crystal Reports 2011, Crystal Reports 2013, Connection U , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To