Skip to content

julianhyde/scott-data-hsqldb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Maven Central

scott-data-hsqldb

Scott data set in hsqldb format

This project contains the Scott data set as an HSQLDB database.

It originated as the "Scott/Tiger" account that has been installed with Oracle since time immemorial.

To connect and read data

Add the following to your Maven pom.xml:

<dependencies>
  <dependency>
    <groupId>org.hsqldb</groupId>
    <artifactId>hsqldb</artifactId>
    <version>2.6.1</version>
  </dependency>
  <dependency>
    <groupId>net.hydromatic</groupId>
    <artifactId>scott-data-hsqldb</artifactId>
    <version>0.2</version>
  </dependency>
</dependencies>

(scott-data-hsqldb supports HSQLDB 2.0.0 and higher, and Java 8 and higher; note that HSQLDB 2.6.0 and higher requires Java 11 and higher.)

Connect to the database via the URL, user name and password in the ScottHsqldb class:

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

import net.hydromatic.scott.data.hsqldb;

Connection connection =
  DriverManager.getConnection(ScottHsqldb.URI, ScottHsqldb.USER, ScottHsqldb.PASSWORD);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("select * from EMP");

Using SQLLine

Connect from the command line using the SQLLine shell:

$ ./sqlline
sqlline version 1.12.0
sqlline> !connect jdbc:hsqldb:res:scott SCOTT TIGER
0: jdbc:hsqldb:res:scott> select * from dept;
+--------+----------------+---------------+
| DEPTNO |     DNAME      |      LOC      |
+--------+----------------+---------------+
| 10     | ACCOUNTING     | NEW YORK      |
| 20     | RESEARCH       | DALLAS        |
| 30     | SALES          | CHICAGO       |
| 40     | OPERATIONS     | BOSTON        |
+--------+----------------+---------------+
4 rows selected (0.002 seconds)

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

Get scott-data-hsqldb

From Maven

Get scott-data-hsqldb from Maven Central:

<dependency>
  <groupId>net.hydromatic</groupId>
  <artifactId>scott-data-hsqldb</artifactId>
  <version>0.2</version>
</dependency>

Download and build

Use Java version 11 or higher.

$ git clone git://github.com/julianhyde/scott-data-hsqldb.git
$ cd scott-data-hsqldb
$ ./mvnw install

On Windows, the last line is

> mvnw install

See also

Similar data sets:

More information