Connecting iReport to Vertica

I’m continuing my journey of connecting JasperReports and Vertica, and it’s not an easy task.
The Vertical team did some damage – they changed their JDBC driver class name (it used to be com.vertica.Driver and now it com.vertica.jdbc.Driver), so the iReport application doesn’t let you connect to the Vertica database, since you constantly get a ClassNotFoundException.
Have no fear – it’s easy to fix.

  1. Add the Vertica JDBC driver JAR to the iReport ClassPath. It can be done under Tools|Options–>ClassPath. Just click the “Add JAR” button and map it to the location of your JAR file
  2. Create a new XML file, with the following data (update to your environment):
    <?xml version="1.0"?>
    <iReportConnectionSet>
    	<iReportConnection name="Vertica" connectionClass="com.jaspersoft.ireport.samples.db.SampleDatabaseConnection">
    		<connectionParameter name="ServerAddress"><![CDATA[IP_ADDR]]></connectionParameter>
    		<connectionParameter name="SavePassword"><![CDATA[true]]></connectionParameter>
    		<connectionParameter name="Url"><![CDATA[jdbc:vertica://IP_ADDR:5433/DB_NAME]]></connectionParameter>
    		<connectionParameter name="JDBCDriver"><![CDATA[com.vertica.jdbc.Driver]]></connectionParameter>
    		<connectionParameter name="Database"><![CDATA[DB_NAME]]></connectionParameter>
    		<connectionParameter name="Password"><![CDATA[PASSWORD]]></connectionParameter>
    		<connectionParameter name="Username"><![CDATA[dbadmin]]></connectionParameter>
    	</iReportConnection>
    </iReportConnectionSet>
    
  3. Create a new Data Source. Click the Report Datasources icon, and instead of new, click import and choose the XML file you created.

Your report should now work with Vertica.

3 thoughts on “Connecting iReport to Vertica

  1. Great!! Was struggling with this for so long. However, I have some more issues with the connection. I added my Vertica config to XML and added it as datasource and imported the XML, just as mentioned. I even tested the connection with success and saved it. However, if I try to generate a report using the connection, it says it cant find the table I am querying, and when I go back and check the details of the datasource I had added, it is auto-changed itself to the Sample data settings.. How could this be happening?

  2. Hi Isha – no clue. Try changing the name attribute of the iReportConnection tag, maybe they clash with the existing configuration?

Leave a Reply

Your email address will not be published. Required fields are marked *