sqlite

SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine. SQLite is the most used database engine in the world.

DjangoREST also supports sqlite.

There is also a JDBC driver for it (Github source code) and it's JPA compliant.

A JDBC sample URL for a DB stored in sample.db file is

jdbc:sqlite:sample.db

   1 apt install sqlite3
   2 sqlite3 test.db 

   1 -- SQL steps
   2 CREATE TABLE IF NOT EXISTS PushNotificationsTable (push text);
   3 insert into PushNotificationsTable values('aaa');
   4 select * from PushNotificationsTable;
   5 .help
   6 .databases
   7 .tables
   8 .dbinfo
   9 .output out.txt
  10 .dump PushNotificationsTable
  11 .quit

Spring notes

pom.xml

   1 <?xml version="1.0" encoding="UTF-8"?>
   2 <project xmlns="http://maven.apache.org/POM/4.0.0" 
   3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
   5 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   6 
   7   <dependencies>
   8     <dependency>
   9       <groupId>com.zsoltfabok</groupId>
  10       <artifactId>sqlite-dialect</artifactId>
  11       <version>1.0</version>
  12     </dependency>
  13     <dependency>
  14       <groupId>org.xerial</groupId>
  15       <artifactId>sqlite-jdbc</artifactId>
  16       <version>3.45.1.0</version>
  17     </dependency>
  18   </dependencies>
  19 </project>

application.properties

spring.datasource.url=jdbc:sqlite:/tmp/test.db
spring.datasource.driverClassName=org.sqlite.JDBC
spring.datasource.username=sa
spring.datasource.password=????????
spring.jpa.database-platform=org.hibernate.dialect.SQLiteDialect
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=true

application.yaml

   1 spring:
   2   datasource:
   3     url: jdbc:sqlite:/tmp/test.db
   4     driverClassName: org.sqlite.JDBC
   5     username: sa
   6     password: ????????
   7   jpa:
   8     database-platform: org.hibernate.dialect.SQLiteDialect
   9     hibernate:
  10       ddl-auto: create-drop
  11     show-sql: true

sqlite (last edited 2024-03-14 22:56:11 by vitor)