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.
- 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
- Create a new XML file, with the following data (update to your environment):
[xml]
<?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>
[/xml] - 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.