0

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 the full error

0

1 Answer 1

3

M1 support is released in 3.32.3.3 of sqlite-jdbc, but you are using 3.25.2. So, please update your dependency

Sign up to request clarification or add additional context in comments.

2 Comments

change the dependency and it's working thanks !
Please mark the answer as "accepted", so other users easily see it helped.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.