dinsdag 5 juni 2012

Typical Open Source Java experience

Today I decided to give Jaspersoft a go. Read about it, seems to be good, all new ‘Jaspersoft Studio’ waiting to be tested. Installation is a breeze (that is not so typical, that’s excellent).

So I started it. Nice splash screen. And a welcome screen. With a cheat sheet for setting up your first data connection. There comes the familiar part. It first tells me where to find the repository with data connections and how to create a new one. And then – we’re still in the very first cheat sheet, should be a simple start:

“Set the correct JDBC driver name. You will have to add the jar(s) of the driver in order to be able to connect to your database. When done, press Test to test your connection.” Besides that you have to figure out the correct JDBC URL, which is not even mentioned in the cheat sheet.

What????? What is the correct JDBC driver name for my SQL Server 2008R2 database? What jar(s) do I need, and where should I add them?

OK, I’m a programmer (albeit not in Java) so I will probably figure it out. Especially since I had to do the same for Talend Open Studio for Data Integration a while ago. So I also know that in order to make the jtds SQL Server driver work with Windows Integrated Security, I should (and did) install the Studio in a path without spaces (so the default ‘Program Files’ is not good).

But hey, was it too difficult to put some frequently used drivers (SQL Server is hardly exotic, is it?) in the installer and be able to construct the right driver name with some clever dropdowns? That’s what I’m used to in Visual Studio, even in the (also free) express editions.

So, tip to all the major open source providers to flatten the learning curve: If you need a connection to a database to do anything useful, pre-configure the most used ones (Oracle, SQL Server, MySQL – should cover many cases already), so the first time user only needs to fill in the servername, databasename, username and password. When he has played around a little, he will be much more forgiving if he has to configure a JDBC driver for his more exotic databases.

[… trying out further …]

Allright, established a data connection to my database, works. Created a new report (based on ‘Coffee’), specified a query on a simple table: works. Preview the report: ClassDefNotFound, apparently on some class having to do with Groovy.

Selected Java as the language for the report, instead of Groovy. Preview the report: NullPointerException. How am I supposed to make this work, if I get two exceptions out of the box? I have not even programmed a statement of Java myself. I’m disappointed. Yet, I’ll give iReport a try to see if that is more mature.

[… trying out iReport …]

OK, works. I still had to add the jtds driver and specify the right JDBC URL, but by now I know what to do. This time, the report still didn’t work, but iReport is indeed more mature and robust. It stated: report has no pages.

Aha, could it be that the table that I query is empty? Check, yes it is. Could that be the cause of the nullpointerreference in JasperSoft Studio? Fill the table, start JSS – no error anymore!

OK. First thing to do with new code: Create unittests for the regular and the edge cases. A report with no data is an edge case. Should have been tested.

To end positively: Two report designers, both free and I managed to squeeze out simple reports on my own table in one day. Not bad after all – for free products.