Logo

dev-resources.site

for different kinds of informations.

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

Published at
12/17/2024
Categories
java
sql
sqlite
jdbc
Author
carter907
Categories
4 categories in total
java
open
sql
open
sqlite
open
jdbc
open
Author
9 person written this
carter907
open
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.

jdbc Article's
30 articles in total
Favicon
Simplify Python-Informix Connections with wbjdbc
Favicon
🚀 Mastering JDBC: Bridging Java and Databases Seamlessly 📊
Favicon
LIBRARY MANAGEMENT SYSTEM USING JAVA AND SQL
Favicon
Java JDBC + IntelliJ + SQLite - A Beginner's Walkthrough
Favicon
Java Backend Management Project
Favicon
JDBC and Streams have never been simpler
Favicon
Quick tip: Using SingleStore for Iceberg Catalog Storage
Favicon
Introducing Kuery Client for those who love writing SQL in Kotlin/JVM
Favicon
Performance tests IRIS - PostgreSQL - MySQL
Favicon
Mastering Conversations: A Guide to Building and Using a Java-Based Chat (StarChat) with IRIS Cloud SQL.
Favicon
Understanding JDBC Three-Tier Architecture: A Detailed Overview
Favicon
Spring Boot Security with JDBC Authentication
Favicon
Wednesday Links - Edition 2024-01-10
Favicon
Constant Lag in CDC Pipeline (JDBC Sink Connector)
Favicon
How to Connect Java Applications to Databases with JDBC
Favicon
Wednesday Links - Edition 2023-08-30
Favicon
How JDBC Paved the Way for Java Frameworks! 🛤️
Favicon
Connect to JDBC in java using MySQL
Favicon
JDBC program for Delete operation
Favicon
Spring JDBC 6 CRUD Operations
Favicon
Java JDBC CRUD Operations in Eclipse using MySql
Favicon
Tutorial - Develop IRIS using SSH
Favicon
Spark Update Optimizations
Favicon
Tips and tricks of the brand new LOAD DATA command
Favicon
Configure the SQuirreL SQL Client to use the SingleStore JDBC Driver
Favicon
Mapping with SCHEMA
Favicon
Built in multi model integration using InterSystems iris data platform
Favicon
Use JDBC to connect TiDB Cloud through TLS
Favicon
Connect your Java application with any SQL databases
Favicon
Java and MySQL

Featured ones: