Coder Social home page Coder Social logo

csanycall / sqlite-jdbc-crypt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from willena/sqlite-jdbc-crypt

0.0 0.0 0.0 331.01 MB

SQLite JDBC Driver with encryption and authentication support

License: Apache License 2.0

Shell 6.49% C++ 14.15% C 7.15% Java 71.35% Makefile 0.86%

sqlite-jdbc-crypt's Introduction

SQLite JDBC Driver

GitHub Workflow Status (branch) Maven Central javadoc Sonatype Nexus (Snapshots)

SQLite JDBC is a library for accessing and creating SQLite database files in Java.

This particular fork uses another native library that provides an implementation of SEE. the native library is provided by Utelle as part of the SQLite3MultipleCiphers project

Our SQLiteJDBC library requires no configuration since native libraries for major OSs, including Windows, macOS, Linux etc., are assembled into a single JAR (Java Archive) file.

Usage

➡️ More usage examples and configuration are available in USAGE.md

SQLite JDBC is a library for accessing SQLite databases through the JDBC API. For the general usage of JDBC, see JDBC Tutorial or Oracle JDBC Documentation.

  1. Download sqlite-jdbc-(VERSION).jar then append this jar file into your classpath.
  2. Open a SQLite database connection from your code. (see the example below)

Example usage

Assuming sqlite-jdbc-(VERSION).jar is placed in the current directory.

> javac Sample.java
> java -classpath ".;sqlite-jdbc-(VERSION).jar" Sample   # in Windows
or
> java -classpath ".:sqlite-jdbc-(VERSION).jar" Sample   # in macOS or Linux
name = leo
id = 1
name = yui
id = 2

Sample.java

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;

    public class Sample
    {
      public static void main(String[] args)
      {
        Connection connection = null;
        try
        {
          // create a database connection
          connection = DriverManager.getConnection("jdbc:sqlite:sample.db");
          Statement statement = connection.createStatement();
          statement.setQueryTimeout(30);  // set timeout to 30 sec.

          statement.executeUpdate("drop table if exists person");
          statement.executeUpdate("create table person (id integer, name string)");
          statement.executeUpdate("insert into person values(1, 'leo')");
          statement.executeUpdate("insert into person values(2, 'yui')");
          ResultSet rs = statement.executeQuery("select * from person");
          while(rs.next())
          {
            // read the result set
            System.out.println("name = " + rs.getString("name"));
            System.out.println("id = " + rs.getInt("id"));
          }
        }
        catch(SQLException e)
        {
          // if the error message is "out of memory",
          // it probably means no database file is found
          System.err.println(e.getMessage());
        }
        finally
        {
          try
          {
            if(connection != null)
              connection.close();
          }
          catch(SQLException e)
          {
            // connection close failed.
            System.err.println(e.getMessage());
          }
        }
      }
    }

How does SQLiteJDBC work?

Our SQLite JDBC driver package (i.e., sqlite-jdbc-(VERSION).jar) contains three types of native SQLite libraries (sqlite-jdbc.dll, sqlite-jdbc.jnilib, sqlite-jdbc.so), each of them is compiled for Windows, macOS and Linux. An appropriate native library file is automatically extracted into your OS's temporary folder, when your program loads org.sqlite.JDBC driver.

Supported Operating Systems

Since sqlite-jdbc-3.6.19, the natively compiled SQLite engines will be used for the following operating systems:

x86 x86_64 armv5 armv6 armv7 arm64 ppc64
Windows
macOS
Linux (libc)
Linux (musl)
Android
FreeBSD

If you want to use the native library for your OS, build the source from scratch.

Download

Download from Maven Central or from the releases page.

<dependencies>
    <dependency>
      <groupId>io.github.willena</groupId>
      <artifactId>sqlite-jdbc</artifactId>
      <version>(version)</version>
    </dependency>
</dependencies>

Snapshots of the development version are available in Sonatype's snapshots repository.

Project versioning explained

The project's version follows the version of the SQLite library that is bundled in the jar, with an extra digit to denote the project's increment.

For example, if the SQLite version is 3.39.2, the project version will be 3.39.2.x, where x starts at 0, and increments with every release that is not changing the SQLite version.

If the SQLite version is updated to 3.40.0, the project version will be updated to 3.40.0.0.

Hint for maven-shade-plugin

You may need to add shade plugin transformer to solve No suitable driver found for jdbc:sqlite: issue.

<transformer
	implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
	<resource>META-INF/services/java.sql.Driver</resource>
</transformer>
<dependency>
    <groupId>io.github.willena</groupId>
    <artifactId>sqlite-jdbc</artifactId>
    <version>(version)</version>
</dependency>

How can I help?

We are always looking for:

Please read our contribution guide.

sqlite-jdbc-crypt's People

Contributors

xerial avatar willena avatar gotson avatar gbatumbya avatar gitblit avatar sualeh avatar github-actions[bot] avatar dependabot[bot] avatar mkauf avatar fatalmind avatar woehrl01 avatar kares avatar michael-o avatar joelcarranza avatar joshimoo avatar trohwer avatar pyckle avatar doe300 avatar andyjefferson avatar snago avatar jberkel avatar tildedave avatar kroggen avatar chris-sp365 avatar zachee54 avatar reftel avatar witmoca avatar b3nn0 avatar hadrabap avatar peterholak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.