Java Bytecode Assembly, Interesting concepts in the art of Computer Science/Software Development, maybe from time to time other pesky corp. related development issues.

Monday, December 14, 2009

Jasper Reports hsqldb database setup

This post is part of Jasper Reports demo documentation project, please read that post for information on downloading the discussed demo files
Jasper Report distribution comes with a sample database populated with data which proves to be as useful as it can be for running the supplied demo reports / testing concepts before implementing in production environments.

To use this database you will need to
  1. Have it up and running
  2. Configure the connection in iReports

On a linux box this is straight forward as explained below (Win/OSX and others should have similar guide lines).


Have HSqlDB it up and running

// Demonstrated for iReports, JasperReports v3.7.0

Open up a terminal windows and issue the following commands:

$ cd JasperReports/jasperreports-3.7.0/demo/hsqldb/
$ ant


You will see output similar to this
Buildfile: build.xml

runServer:
[java] [Server@15c7850]: [Thread[main,5,main]]: checkRunning(false) entered
[java] [Server@15c7850]: [Thread[main,5,main]]: checkRunning(false) exited
[java] [Server@15c7850]: Startup sequence initiated from main() method
[java] [Server@15c7850]: Loaded properties from [/home/maximv/Desktop/JasperReports/jasperreports-3.7.0/demo/hsqldb/server.properties]
[java] [Server@15c7850]: Initiating startup sequence...
[java] [Server@15c7850]: Server socket opened successfully in 4 ms.
[java] [Server@15c7850]: Database [index=0, id=0, db=file:test, alias=] opened sucessfully in 607 ms.
[java] [Server@15c7850]: Startup sequence completed in 612 ms.
[java] [Server@15c7850]: 2009-12-14 18:32:33.542 HSQLDB server 1.8.0 is online
[java] [Server@15c7850]: To close normally, connect and execute SHUTDOWN SQL
[java] [Server@15c7850]: From command line, use [Ctrl]+[C] to abort abruptly

That's it. Keep the terminal window open otherwise the DB will shutdown. The database can be accessed locally using the

Path: jdbc:hsqldb:hsql://localhost
Username: sa
Password: "" (blank, no password).

Configure the HSqlDB connection in iReports


In iReports the setup is as follows:
  1. Click the new data source connection button:



  2. Click the new connection



  3. Configure connection to the hsqldb datasource



    That is

    JDBC Driver = HSQLDB (server) (org.hsqldb.jdbcDriver)
    JDBC URL = jdbc:hsqldb:hsql://localhost

    Username = sa
    Password =        ([V] Save password)

  4. Test the connection is working.


    After configuring the connection you should click the "Test" button, if everything goes well the following popup windows will confirm this.


No comments:

Post a Comment

About Me

My photo
Tel Aviv, Israel
I work in one of Israel's Hi-Tech company's. I do 5 nines system development with some system administration. This blog will focus on the technical side of things, with some philosophical strings attached.