I do not know what you mean by "technicalities," but in terms of performance, it's notorious that JDBC is faster. I did an algorithm to test:
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.sqlite.SQLiteConnection;
public class SQLiteConnTest {
public static void main(String[] args) {
long startTime, endTime;
double duration;
File path = new File(System.getProperty("user.dir"));
System.out.println("Conexao com SQLiteConnection...");
startTime = System.nanoTime();
sqliteConnection(path);
endTime = System.nanoTime();
duration = (endTime - startTime) / 1000000d;
System.out.println("Tempo(ms): " + String.format("%.3f", duration));
System.out.println("Conexao com JDBC...");
startTime = System.nanoTime();
jdbcConnection(path);
endTime = System.nanoTime();
duration = (endTime - startTime) / 1000000d;
System.out.println("Tempo(ms): " + String.format("%.3f", duration));
}
public static void sqliteConnection(File path) {
try {
SQLiteConnection conn = new SQLiteConnection(path.getAbsolutePath(), "DadosPastas.s3db");
System.out.println("SQLiteConnection has opened");
conn.close();
System.out.println("SQLiteConnection has closed");
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void jdbcConnection(File path) {
try {
Class.forName("org.sqlite.JDBC");
Connection c = DriverManager.getConnection("jdbc:sqlite:" + path + "/test.db");
System.out.println("JDBC Connection has opened");
c.close();
System.out.println("JDBC Connection has closed");
} catch (Exception e) {
e.printStackTrace();
}
}
}
In the test, I calculate the time in which both forms take to open and close the connection next.
In the first test, I ran without any of the benches being created, to see if having to create it influences time. The output was:
Conexao com SQLiteConnection...
SQLiteConnection has opened
SQLiteConnection has closed
Tempo(ms): 227,829
Conexao com JDBC...
JDBC Connection has opened
JDBC Connection has closed
Tempo(ms): 3,559
Once with the created banks, I ran again:
Conexao com SQLiteConnection...
SQLiteConnection has opened
SQLiteConnection has closed
Tempo(ms): 249,077
Conexao com JDBC...
JDBC Connection has opened
JDBC Connection has closed
Tempo(ms): 3,039
It is noticed that the time difference between the two is great, with JDBC being much more performative than the SQLiteConnection
class. This is because jdbc is native, which will make it almost always be faster.
I do not know where you found this way to connect with this class, but even the driver documentation itself suggests use DriverManager , and do not say anything about this way you tested it.