This post is part of Jasper Reports demo documentation project, please read that post for information on downloading the discussed demo filesJasper 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
- Have it up and running
- 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/
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
Password: "" (blank, no password).
Configure the HSqlDB connection in iReports
In iReports the setup is as follows:
- Click the new data source connection button:
- Click the new connection
- Configure connection to the hsqldb datasource
JDBC Driver = HSQLDB (server) (org.hsqldb.jdbcDriver)
JDBC URL = jdbc:hsqldb:hsql://localhost
Username = sa
Password = ([V] Save password)
- 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.