DEV Community

Carter
Carter

Posted on

1

Java JDBC + IntelliJ + SQLite - A Beginner's Walkthrough

IntelliJ Community + JDBC + SQLITE

(or any other database)

  • no build tool required (Maven or Gradle)
  • we'll be downloading the sqlite command-line shell (https://www.sqlite.org/cli.html)
    • this will make it easy to create a database file and use it as our connection in jdbc.
  • sqlite drivers from (org.xerial.sqlite)

Step 1: Project Setup

1.1 create a new project

File > New > Project..

Image description

click on New Project
pick a name for your project (we will be calling it jdbc-test)
click Create

1.2 adding the sqlite driver

Image description

once your new project is created go to

File > Project Structure > Libraries

click the + sign and then Maven
(you could also download the jar yourself
sqlite driver jar,
Maven just does it for you)

Image description

  • search for org.xerial.sqlite-driver and use the latest version (3.42.0.0 as of this commit)
  • optional: you can choose to store your library in a lib folder for organizational purposes.
  • click okay to add the dependency.

Step 2: Getting a Database File with the SQLite

2.1 downloading the tool

Image description

visit the sqlite downloads page
install the precompiled binaries for your target OS

  • make sure your download has the following description:

A bundle of command-line tools for managing SQLite database files,
including the command-line shell program, the sqldiff.exe program,
and the sqlite3_analyzer.exe program.

2.1 identifying your tools

Image description

  • unzip the downloaded folder and view the contents inside.
  • you should see sqldiff, sqlite3, and sqlite3_analyzer.
  • you are only interested in sqlite3 for now.
  • start sqlite3

2.3 using sqlite3 cli

Image description

  • to create a new database file simply type

.save [name-of-database-file]

  • this will create a new file in the same folder as the sqlite3 application.

2.4 handling the database resource file

  • move the file into your IntelliJ Community Edition project.
  • you can store in the root directory or in some resource folder

Image description

Step 3: Using JDBC and SQLite

you are now ready to start using Sqlite and JDBC!

look through the source code for a quick example using our newly created database file.

DevCycle image

Fast, Flexible Releases with OpenFeature Built-in

Ship faster on the first feature management platform with OpenFeature built-in to all of our open source SDKs.

Start shipping

Top comments (0)

Tiger Data image

🐯 🚀 Timescale is now TigerData: Building the Modern PostgreSQL for the Analytical and Agentic Era

We’ve quietly evolved from a time-series database into the modern PostgreSQL for today’s and tomorrow’s computing, built for performance, scale, and the agentic future.

So we’re changing our name: from Timescale to TigerData. Not to change who we are, but to reflect who we’ve become. TigerData is bold, fast, and built to power the next era of software.

Read more

👋 Kindness is contagious

Explore this compelling article, highly praised by the collaborative DEV Community. All developers, whether just starting out or already experienced, are invited to share insights and grow our collective expertise.

A quick “thank you” can lift someone’s spirits—drop your kudos in the comments!

On DEV, sharing experiences sparks innovation and strengthens our connections. If this post resonated with you, a brief note of appreciation goes a long way.

Get Started