SAP Knowledge Base Article - Public

1527666 - How to connect to a database using a JDBC connection in Crystal Reports? [Video]

Symptom

  • How to configure a JDBC connection?
  • How to create a report using a JDBC connection in Crystal Reports?
  • How to connect to a database via 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:
       
    1. 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
                   
    2. Download a supported JDBC driver from your database vendor website.
              
    3. 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
             
    4. Add the path of the JDBC driver .jar file, to the classpath of the Crystal Reports configuration file: crconfig.xml: 
        
      1. 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.
               
      2. 4.2 Open in a Text Editor the file: crconfig.xml
          
      3. 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:\Program Files (x86)\MS SQL Server JDBC Driver\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:\Program Files (x86)\MS SQL Server JDBC Driver\sqljdbc_6.0\sqljdbc42.jar</Classpath>
                  <UseProxy>FALSE</UseProxy>
                  <ProxyAddress></ProxyAddress>
                  <ProxyPort></ProxyPort>
             </DataDriverCommon>
            

      4. 4.4 Save the change made in the file: crconfig.xml
            
    5. Start Crystal Reports, and create a new report.   ( Under the menu "File" select "New – Blank Report" )
            
    6. In the "Database Expert", under "Create New Connection", double click on: JDBC (JNDI)
           
    7. 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
              
        
    8. 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

Product

SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020