I have a customer that asked me to build a Vertica environment and connect it to JasperReports. Fun!
So, it took a while (mostly due to technical difficulties on my end), but it works. And I thought I’d document how.
- Install Vertica. That’s an easy task, lots of documentation on the Vertica site. Frankly – I haven’t read any of it. Just clickty-click and you’re done.
- Create the Vertica database. Use
/opt/vertica/bin/adminToolsfor that. Make sure you run it under the
su - dbadminif you have problems to login directly).
- Install Tomcat. I used Tomcat 6, but 7 is supported too.
- Install JasperReports Server (can be downloaded here). I used the WAR file version (had problems with the X Windows support over SSH) – see installation documentation here. This was not the easiest thing to do.
- Copy the Vertica JDBC driver to Tomcat (from
- Start Tomcat (using
- Log in to the Jasper Reports application at
http://your_host:8080/jasperreports. Default username is
jasperreportsand the password is
Create a new DataSource in Jasper. For driver class enter
com.vertica.jdbc.Driver. For URL enter
jdbc:vertica://vertica_host:5433/db_name. User is
dbadminand password is the database password you entered when you created the database
Turns out I was overly optimistic. Although Jasper UI shows the connection works, reports can’t run with this connection. You need to use a JNDI Data Source connection. Easy to do:
- Open the
context.xmlfile in the
- Add the following lines:
<Resource name="jdbc/vertica" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
- Now create a JNDI based data source in Jasper (see here for more details)
- I have also saw that the
TOMCAT_HOME/conf/Catalina/default/jasperreports.xmlfile needs to be updated, and contain the same code snippet from above. I have no clue why Tomcat doesn’t update this file automatically.
- Restart the Tomcat server
- Open the
That’s it. Hope it helped 😉