Skip to content

hydromatic/sakila-data-hsqldb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Maven Central javadoc

Sakila Data Set in HSQLDB Format

Overview

The sakila-data-hsqldb project provides the Sakila dataset as an embedded HSQLDB database.

The Sakila database is a sample database that models a DVD rental store business. It was originally developed by Mike Hillyer of the MySQL AB documentation team as an example database for MySQL.

Schema Structure

The database contains 16 tables:

Table Rows Columns
ACTOR 200 4
ADDRESS 603 8
CATEGORY 16 3
CITY 600 4
COUNTRY 109 3
CUSTOMER 599 9
FILM 1,000 13
FILM_ACTOR 5,462 3
FILM_CATEGORY 1,000 3
FILM_TEXT 0 3
INVENTORY 4,581 4
LANGUAGE 6 3
PAYMENT 16,049 7
RENTAL 16,044 7
STAFF 2 11
STORE 2 4

The database is approximately 4.6 MB, compressing to about 629 KB.

Sakila schema diagram

(Schema diagram courtesy of jOOQ.)

Getting Started

Maven Integration

Add the following dependency to your Maven pom.xml file:

<dependency>
  <groupId>net.hydromatic</groupId>
  <artifactId>sakila-data-hsqldb</artifactId>
  <version>0.1</version>
</dependency>

Note: sakila-data-hsqldb supports HSQLDB 2.0.0 and higher, and Java 8 and higher. HSQLDB 2.6.0 and higher requires Java 11 and higher.

Java Connection Example

Connect using the JDBC URL jdbc:hsqldb:res:sakila with username "sakila" and password "p_ssW0rd":

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import net.hydromatic.sakila.data.hsqldb.SakilaHsqldb;

Connection connection =
  DriverManager.getConnection(SakilaHsqldb.URI,
      SakilaHsqldb.USER, SakilaHsqldb.PASSWORD);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(
    "SELECT \"film_id\", \"title\", \"release_year\" FROM \"FILM\" LIMIT 5");

Using SQLLine

Connect from the command line using the SQLLine shell:

$ ./sqlline
sqlline version 1.12.0
sqlline> !connect jdbc:hsqldb:res:sakila SAKILA SAKILA
0: jdbc:hsqldb:res:sakila> SELECT "film_id", "title", "release_year"
. . . . . . . . . . . . .> FROM "FILM" LIMIT 5;
+---------+------------------+--------------+
| film_id |      title       | release_year |
+---------+------------------+--------------+
| 1       | ACADEMY DINOSAUR | 2006         |
| 2       | ACE GOLDFINGER   | 2006         |
| 3       | ADAPTATION HOLES | 2006         |
| 4       | AFFAIR PREJUDICE | 2006         |
| 5       | AFRICAN EGG      | 2006         |
+---------+------------------+--------------+
5 rows selected (0.002 seconds)

You may need to edit the sqlline or sqlline.bat launcher script, adding sakila-data-hsqldb.jar to your class path.

Download and build

Use Java version 11 or higher.

git clone https://github.com/hydromatic/sakila-data-hsqldb.git
cd sakila-data-hsqldb
./mvnw install

On Windows, the last line is

> mvnw install

Related Resources

Similar data sets:

Lukas Eder at the jOOQ project has ported Sakila to IBM DB2, Oracle, Postgres and other databases.

More Information

About

Sakila database in HSQLDB format

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages