SlideShare a Scribd company logo
HSQLDB Tutorial
HyperSQL Database is a modern relational database manager that
conforms closely to the SQL:2011 standard and JDBC 4 specifications. It
supports all core features and RDBMS. HSQLDB is used for the
development, testing, and deployment of database applications.
Features of HSQLDB
• HSQLDB uses in-memory structure for fast operations against
DB server. It uses disk persistence as per user flexibility, with a
reliable crash recovery.
• HSQLDB is also suitable for business intelligence, ETL, and
other applications that process large data sets.
• HSQLDB has a wide range of enterprise deployment options,
such as XA transactions, connection pooling data sources, and
remote authentication.
• HSQLDB is written in the Java programming language and runs
in a Java Virtual Machine (JVM). It supports the JDBC interface
for database access.
Components of HSQLDB
• There are three different components in HSQLDB jar package.
• HyperSQL RDBMS Engine (HSQLDB)
• HyperSQL JDBC Driver
• Database Manager (GUI database access tool, with Swing and
AWT versions)
• HyperSQL RDBMS and JDBC Driver provide the core
functionality. Database Managers are general-purpose
database access tools that can be used with any database
engine having a JDBC driver.
Example
• import java.sql.Connection;
• import java.sql.DriverManager;
• public class ConnectDatabase {
• public static void main(String[] args) {
• Connection con = null;
•
• try {
• //Registering the HSQLDB JDBC driver
• Class.forName("org.hsqldb.jdbc.JDBCDriver");
• //Creating the connection with HSQLDB
• con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/testdb", "SA", "");
• if (con!= null){
• System.out.println("Connection created successfully");
•
• }else{
• System.out.println("Problem with creating connection");
• }
•
• } catch (Exception e) {
• e.printStackTrace(System.out);
• }
• }
• }
• >cd C:hsqldb-2.3.4hsqldb hsqldb>java -classpath
lib/hsqldb.jar org.hsqldb.server.Server --database.0
file:hsqldb/de
• >javac ConnectDatabase.java >java ConnectDatabasemodb --
dbname.0 testdb
Approximate Numeric Data Types
Data Type From To
float -1.79E + 308 1.79E + 308
real -3.40E + 38 3.40E + 38
Date and Time Data Types
Data Type From To
datetime Jan 1, 1753 Dec 31, 9999
smalldatetime Jan 1, 1900 Jun 6, 2079
date Stores a date like June 30, 1991
time Stores a time of day like 12:30 P.M.
Syntax
• The basic mandatory requirements to create a table are table
name, field names, and the data types to those fields.
Optionally, you can also provide the key constraints to the
table.
• Take a look at the following syntax.
• CREATE TABLE table_name (column_name column_type);
Example
• Let us create a table named tutorials_tbl with the field-names
such as id, title, author, and submission_date. Take a look at
the following query.
• CREATE TABLE tutorials_tbl ( id INT NOT NULL, title
VARCHAR(50) NOT NULL, author VARCHAR(20) NOT NULL,
submission_date DATE, PRIMARY KEY (id) );
HSQLDB–JDBCProgram
FollowingistheJDBCprogramusedtocreateatablenamedtutorials_tblintotheHSQLDBdatabase.
SavetheprogramintoCreateTable.javafile.
• import java.sql.Connection;
• import java.sql.DriverManager;
• import java.sql.Statement;
• public class CreateTable {
•
• public static void main(String[] args) {
•
• Connection con = null;
• Statement stmt = null;
• int result = 0;
•
• try {
• Class.forName("org.hsqldb.jdbc.JDBCDriver");
• con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/testdb", "SA", "");
• stmt = con.createStatement();
•
• result = stmt.executeUpdate("CREATE TABLE tutorials_tbl (
• id INT NOT NULL, title VARCHAR(50) NOT NULL,
• author VARCHAR(20) NOT NULL, submission_date DATE,
• PRIMARY KEY (id));
• ");
•
• } catch (Exception e) {
• e.printStackTrace(System.out);
• }
• System.out.println("Table created successfully");
• }
• }
Syntax
• It is very easy to drop an existing HSQLDB table. However, you
need to be very careful while deleting any existing table as any
data lost will not be recovered after deleting a table.
• Following is a generic SQL syntax to drop a HSQLDB table.
• DROP TABLE table_name;

More Related Content

PPTX
Introduction to Sql on Hadoop
PPTX
Making MySQL Agile-ish
PDF
Core Data
PPTX
CNU Computer Seminar SQL-ON-HADOOP
PDF
Splitgraph: Docker for Data
PPTX
I say NoSQL you say what
PPTX
U-SQL Meta Data Catalog (SQLBits 2016)
Introduction to Sql on Hadoop
Making MySQL Agile-ish
Core Data
CNU Computer Seminar SQL-ON-HADOOP
Splitgraph: Docker for Data
I say NoSQL you say what
U-SQL Meta Data Catalog (SQLBits 2016)

What's hot (20)

PPTX
An introduction to Nosql
PPTX
U-SQL Intro (SQLBits 2016)
PPTX
PPTX
Introducing U-SQL (SQLPASS 2016)
PPTX
MS Sql Server: Introduction To Database Concepts
PPTX
Physical architecture of sql server
PPTX
U-SQL User-Defined Operators (UDOs) (SQLBits 2016)
PPTX
Using C# with U-SQL (SQLBits 2016)
PPT
SQLITE Android
PPT
NoSQL databases
PPT
Mongo DB for Java, Python and PHP Developers
PPTX
What is database.pptx
PPTX
Comparing sql and nosql dbs
PPTX
MongoDB introduction
PPTX
Pune-Cocoa: Core data - I
PDF
Nosql databases for the .net developer
PDF
Chapter 4 organizing & manipulating the data in database
PPT
No SQL - A Simple Intro
PDF
An introduction to Nosql
U-SQL Intro (SQLBits 2016)
Introducing U-SQL (SQLPASS 2016)
MS Sql Server: Introduction To Database Concepts
Physical architecture of sql server
U-SQL User-Defined Operators (UDOs) (SQLBits 2016)
Using C# with U-SQL (SQLBits 2016)
SQLITE Android
NoSQL databases
Mongo DB for Java, Python and PHP Developers
What is database.pptx
Comparing sql and nosql dbs
MongoDB introduction
Pune-Cocoa: Core data - I
Nosql databases for the .net developer
Chapter 4 organizing & manipulating the data in database
No SQL - A Simple Intro
Ad

Similar to Hsqldb tutorial (20)

PPTX
Hsqldb tutorial
PPTX
unit-ii.pptx
PPTX
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
PPTX
SQL SERVER Training in Pune Slides
PPT
Database management and System Development ppt
PPT
Object Relational Database Management System
PDF
Database Systems - Introduction to SQL (Chapter 3/1)
PPTX
Lecture - MY-SQL/ SQL Commands - DDL.pptx
PDF
SQL Complete Tutorial. All Topics Covered
PPTX
SQL PPT.pptx
PDF
PT- Oracle session01
PPTX
Query editor for multi databases
PPTX
Using Basic Structured Query Language lo1.pptx
PPT
Module02
PPT
Hive_An Brief Introduction to HIVE_BIGDATAANALYTICS
PPTX
Structured Query Language
PPTX
SQL ppt.pptx
PPTX
SQL.pptx
PDF
SQL_NOTES.pdf
PPTX
05 Create and Maintain Databases and Tables.pptx
Hsqldb tutorial
unit-ii.pptx
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
SQL SERVER Training in Pune Slides
Database management and System Development ppt
Object Relational Database Management System
Database Systems - Introduction to SQL (Chapter 3/1)
Lecture - MY-SQL/ SQL Commands - DDL.pptx
SQL Complete Tutorial. All Topics Covered
SQL PPT.pptx
PT- Oracle session01
Query editor for multi databases
Using Basic Structured Query Language lo1.pptx
Module02
Hive_An Brief Introduction to HIVE_BIGDATAANALYTICS
Structured Query Language
SQL ppt.pptx
SQL.pptx
SQL_NOTES.pdf
05 Create and Maintain Databases and Tables.pptx
Ad

More from Ramakrishna kapa (20)

PPTX
Load balancer in mule
PPTX
Anypoint connectors
PPTX
Batch processing
PPTX
Msmq connectivity
PPTX
Scopes in mule
PPTX
Data weave more operations
PPTX
Basic math operations using dataweave
PPTX
Dataweave types operators
PPTX
Operators in mule dataweave
PPTX
Data weave in mule
PPTX
Servicenow connector
PPTX
Introduction to testing mule
PPTX
Choice flow control
PPTX
Message enricher example
PPTX
Mule exception strategies
PPTX
Anypoint connector basics
PPTX
Mule global elements
PPTX
Mule message structure and varibles scopes
PPTX
How to create an api in mule
PPTX
Log4j is a reliable, fast and flexible
Load balancer in mule
Anypoint connectors
Batch processing
Msmq connectivity
Scopes in mule
Data weave more operations
Basic math operations using dataweave
Dataweave types operators
Operators in mule dataweave
Data weave in mule
Servicenow connector
Introduction to testing mule
Choice flow control
Message enricher example
Mule exception strategies
Anypoint connector basics
Mule global elements
Mule message structure and varibles scopes
How to create an api in mule
Log4j is a reliable, fast and flexible

Recently uploaded (20)

PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Transform Your Business with a Software ERP System
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
AI in Product Development-omnex systems
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Digital Strategies for Manufacturing Companies
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Nekopoi APK 2025 free lastest update
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
ai tools demonstartion for schools and inter college
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
history of c programming in notes for students .pptx
PDF
medical staffing services at VALiNTRY
2025 Textile ERP Trends: SAP, Odoo & Oracle
Transform Your Business with a Software ERP System
Online Work Permit System for Fast Permit Processing
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
AI in Product Development-omnex systems
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Digital Strategies for Manufacturing Companies
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
ManageIQ - Sprint 268 Review - Slide Deck
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Nekopoi APK 2025 free lastest update
Navsoft: AI-Powered Business Solutions & Custom Software Development
ISO 45001 Occupational Health and Safety Management System
ai tools demonstartion for schools and inter college
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Upgrade and Innovation Strategies for SAP ERP Customers
Odoo POS Development Services by CandidRoot Solutions
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
history of c programming in notes for students .pptx
medical staffing services at VALiNTRY

Hsqldb tutorial

  • 1. HSQLDB Tutorial HyperSQL Database is a modern relational database manager that conforms closely to the SQL:2011 standard and JDBC 4 specifications. It supports all core features and RDBMS. HSQLDB is used for the development, testing, and deployment of database applications.
  • 2. Features of HSQLDB • HSQLDB uses in-memory structure for fast operations against DB server. It uses disk persistence as per user flexibility, with a reliable crash recovery. • HSQLDB is also suitable for business intelligence, ETL, and other applications that process large data sets. • HSQLDB has a wide range of enterprise deployment options, such as XA transactions, connection pooling data sources, and remote authentication. • HSQLDB is written in the Java programming language and runs in a Java Virtual Machine (JVM). It supports the JDBC interface for database access.
  • 3. Components of HSQLDB • There are three different components in HSQLDB jar package. • HyperSQL RDBMS Engine (HSQLDB) • HyperSQL JDBC Driver • Database Manager (GUI database access tool, with Swing and AWT versions) • HyperSQL RDBMS and JDBC Driver provide the core functionality. Database Managers are general-purpose database access tools that can be used with any database engine having a JDBC driver.
  • 4. Example • import java.sql.Connection; • import java.sql.DriverManager; • public class ConnectDatabase { • public static void main(String[] args) { • Connection con = null; • • try { • //Registering the HSQLDB JDBC driver • Class.forName("org.hsqldb.jdbc.JDBCDriver"); • //Creating the connection with HSQLDB • con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/testdb", "SA", ""); • if (con!= null){ • System.out.println("Connection created successfully"); • • }else{ • System.out.println("Problem with creating connection"); • } • • } catch (Exception e) { • e.printStackTrace(System.out); • } • } • }
  • 5. • >cd C:hsqldb-2.3.4hsqldb hsqldb>java -classpath lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:hsqldb/de • >javac ConnectDatabase.java >java ConnectDatabasemodb -- dbname.0 testdb
  • 6. Approximate Numeric Data Types Data Type From To float -1.79E + 308 1.79E + 308 real -3.40E + 38 3.40E + 38
  • 7. Date and Time Data Types Data Type From To datetime Jan 1, 1753 Dec 31, 9999 smalldatetime Jan 1, 1900 Jun 6, 2079 date Stores a date like June 30, 1991 time Stores a time of day like 12:30 P.M.
  • 8. Syntax • The basic mandatory requirements to create a table are table name, field names, and the data types to those fields. Optionally, you can also provide the key constraints to the table. • Take a look at the following syntax. • CREATE TABLE table_name (column_name column_type);
  • 9. Example • Let us create a table named tutorials_tbl with the field-names such as id, title, author, and submission_date. Take a look at the following query. • CREATE TABLE tutorials_tbl ( id INT NOT NULL, title VARCHAR(50) NOT NULL, author VARCHAR(20) NOT NULL, submission_date DATE, PRIMARY KEY (id) );
  • 10. HSQLDB–JDBCProgram FollowingistheJDBCprogramusedtocreateatablenamedtutorials_tblintotheHSQLDBdatabase. SavetheprogramintoCreateTable.javafile. • import java.sql.Connection; • import java.sql.DriverManager; • import java.sql.Statement; • public class CreateTable { • • public static void main(String[] args) { • • Connection con = null; • Statement stmt = null; • int result = 0; • • try { • Class.forName("org.hsqldb.jdbc.JDBCDriver"); • con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/testdb", "SA", ""); • stmt = con.createStatement(); • • result = stmt.executeUpdate("CREATE TABLE tutorials_tbl ( • id INT NOT NULL, title VARCHAR(50) NOT NULL, • author VARCHAR(20) NOT NULL, submission_date DATE, • PRIMARY KEY (id)); • "); • • } catch (Exception e) { • e.printStackTrace(System.out); • } • System.out.println("Table created successfully"); • } • }
  • 11. Syntax • It is very easy to drop an existing HSQLDB table. However, you need to be very careful while deleting any existing table as any data lost will not be recovered after deleting a table. • Following is a generic SQL syntax to drop a HSQLDB table. • DROP TABLE table_name;