Issue
I'm trying to connect to an SQLite using MacBook Apple Silicone M1. Here is my code to make the connection the URL is exactly the SQLite name when I create it inside IntelliJ.
Here is the code.
private static final String SQLite_URL = "jdbc:sqlite:identifier.sqlite";
Connection conn = null;
if (DatastoreToggles.isUnderTest) {
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
conn = DriverManager.getConnection(SQLite_URL_TEST);
System.out.println("Connection to test SQLite successful");
}
catch (SQLException e) {
System.out.println(e.getMessage());
}
}
else {
try {
conn = DriverManager.getConnection(SQLite_URL);
System.out.println("Connection to SQLite successful");
}
catch (SQLException e) {
System.out.println(e.getMessage());
}
}
return conn;
}
I already checked other people with similar problems, I did update my maven but the problem is still there.
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.25.2</version>
</dependency>
Test connection inside IntelliJ passes but cannot connect with my code.
Here is the report for the console
Solution
M1 support is released in 3.32.3.3 of sqlite-jdbc, but you are using 3.25.2. So, please update your dependency
Answered By - Konstantin Annikov