DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Kafka JDBC Source Connector for Large Data
  • Amazon Dynamo DB Connector Operations Walkthrough in Mule 4, Part 1
  • How to Use JMS ActiveMQ With Mule 4: Part 2
  • Integrating NoSQL Database With Mule 4 (OOTB Cassandra Connector)

Trending

  • Data Integration Landscape 2026: Event Streaming, API, and Batch in the Era of Agentic AI
  • Claude Code Superpowers: The 5-Tool Stack That Ends Limits and Context Amnesia
  • Genkit Flows on Kubernetes, Routed by a Decision Model: senro + jev in Go
  • Beyond the Wall of Charts: How Advanced Observability Displaced the Telemetry Dashboard

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Data Engineering
  3. Databases
  4. Mule Database Connector With HSQLDB

Mule Database Connector With HSQLDB

Learn how to use the MuleSoft database connector to connect a Mule flow to a HyperSQL (HSQL) database in this integration tutorial.

By 
Mohit Chhabra
·
Sep. 26, 17 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
5.0K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

In this article, I will let you know how to use the database connector in MuleSoft for HSQLDB. Below are the points of which I will be giving a brief description:

  1. How to install the HSQL database on your system.

  2. The Mule flow to connect to the above-created database.

First, we will have some idea about the HSQL database. HSQLDB (HyperSQL Database) is a relational database engine written in Java. I have used version 2.3.4 in my example. This will not take much of the memory and space on your system and will install easily. Below are the steps:

Download the latest version of the HSQLDB database. I have version 2.3.4 downloaded from this link.

Extract the zip file you downloaded in the C directory.

Create a properties file named server.properties under C:\hsqldb-2.3.4\hsqldb, which defines a new database named Mydemodb with the below property lines:

server.database.0 = file:hsqldb/MyDemodb
server.dbname.0 = testdb

Then execute the below command in the command line:

cd C:\hsqldb-2.3.4\hsqldb
hsqldb>java -classpath lib/hsqldb.jar org.hsqldb.server.Server

outputofserverstart

Once we have created a database, we have to start the database by using the following command:

\>cd C:\hsqldb-2.3.4\hsqldb
hsqldb>java -classpath lib/hsqldb.jar org.hsqldb.server.Server --database.0
file:hsqldb/demodb --dbname.0 testdb

 Now you can open the database GUI with runManagerSwing.bat from the C:\hsqldb-2.3.4\hsqldb\bin location. You will be asked to fill in the connection settings; fill them in as below:

settingshsqldb

Now the database GUI will open and you can create your test tables and insert the data.

Now we will see how we can use this database in our Mule flow.

Create a new Mule project "DB_connector_example." We will be creating a flow like below:

muleflow

 First, insert an HTTP inbound connector listening on 8081 and on path /dbconnector.

Insert a logger to log in a message.

Now, here comes the important part: the database connector. Place a DB connector after the logger and define the global database connector as below:

DB connector_1

Global_conf

Also, add the hsqldb2.3.4 jar file in the referenced libraries so that the driver class name can be looked into that Jar file. Right click on your project -->Build Path-->Add external archive and point to the jar file.referenced jar

Now, if your database is running, you can test the connection in the global test configuration. If that is successfully tested, you may proceed with your flow.TestConnection.PNG

Now, if you will place the last logger ( skipping the Object to JSON Transformer) and run your application you will get the below distorted output.

¬í sr java.util.LinkedList)S]J`ˆ"  xpw   sr $org.mule.util.CaseInsensitiveHashMapÑÙïgEÎ
  xpw?@       t ¬í sr java.util.LinkedList)S]J`ˆ"  xpw   sr $org.mule.util.CaseInsensitiveHashMapÑÙïgEÎ
  xpw?@       t EMPLOYEEIDsr java.lang.Integerâ ¤÷‡8 I valuexr java.lang.Number†¬•”à‹
  xp   {t EMPLOYEENAMEt mohitxsq ~ w?@       q ~ q ~ q ~ q ~ xx

Because the output is java.util.LinkedList, which displays on the client side, it is not converted into any standard message format. To convert it to a JSON format, we will use an Object to JSON Transformer in between the logger and DB connector.

Now save your project and run the application. From any browser, hit http://localhost:8081/dbconnector and hit enter; you will get the data from the table.

fteched output.PNG

Relational database HSQLDB Connector (mathematics)

Opinions expressed by DZone contributors are their own.

Related

  • Kafka JDBC Source Connector for Large Data
  • Amazon Dynamo DB Connector Operations Walkthrough in Mule 4, Part 1
  • How to Use JMS ActiveMQ With Mule 4: Part 2
  • Integrating NoSQL Database With Mule 4 (OOTB Cassandra Connector)

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook