Connecting to MySQL with Crystal Reports XI

CrystalReports is not too into the open source scene, consequently it doesn’t work with MySQL out of the box. But you can easily get the Crystal Reports Designer to work against a MySQL database by using JDBC.

  1. Download the MySQL Connector J jar file. That download should contain a jar file that looks something like:
    mysql-connector-java-3.1.14-bin.jar

  2. Add the location of your newly downloaded jar file to the Classpath, as defined in CrystalReports CRConfig.xml file. On a Windows machine, the config file will be located somewhere like:
    C:\Program Files\Business Objects\Common\3.5\java\CRConfig.xml

  3. Once you have altered your CRConfig.xml, close and reopen Crystal Reports.
  4. From the menu: File -> New -> Standard Report
  5. In the “Available Data Sources” list, double-click to expand “Create New Connection”
  6. Double-click to expand “JDBC (JNDI)”
  7. Double-click “Make New Connection”
  8. Connection URL: “jdbc:mysql://db.example.com/dbname” (Use your own database host name and db name).
  9. Database Classname: “com.mysql.jdbc.Driver”
  10. Click “Next”
  11. Enter a database user/password combination when prompted.
  12. You should now be able to inspect the tables/columns in the database to begin reporting.

If the connection is not allowed, make sure your granted access settings in MySQL allow you to connect from wherever you are. Try connecting using the vanilla MySQL command line client.

One Response to “Connecting to MySQL with Crystal Reports XI”

  1. marvin says:

    Great article! I’ve always used ODBC to connect to MySQL because I didn’t have any idea how to use JDBC. This step-by-step instruction helps me a lot. Thanks you.

Leave a Reply