Skip to content

Error creating a true read only connection #1362

@Borbarad13

Description

@Borbarad13

Describe the bug
It seems to be impossible to create a (truely) read only connection (open_mode = 1) or I might be missing something. I receive the error "SQLiteException: [SQLITE_MISUSE]", which could indicate that those connections are not wanted or that I use the library incorrectly to create them.

To Reproduce

   SQLiteConfig config = new SQLiteConfig();
        config.setOpenMode(SQLiteOpenMode.READONLY);
        try (Connection connection = DriverManager.getConnection(
                "jdbc:sqlite:sqlite", config.toProperties())) {
            } catch (SQLException e) {
            throw new RuntimeException(e);
        }

Expected behavior
Truely read only connections are possible to create (I am not talking about the mutable ones which switch around e.g. via "pragma query_only or via setReadOnly() ).

Logs

Exception in thread "main" java.lang.RuntimeException: org.sqlite.SQLiteException: [SQLITE_MISUSE] Library used incorrectly (bad parameter or other API misuse)
Caused by: org.sqlite.SQLiteException: [SQLITE_MISUSE] Library used incorrectly (bad parameter or other API misuse)
at org.sqlite.core.DB.newSQLException(DB.java:1179)
at org.sqlite.core.DB.newSQLException(DB.java:1190)
at org.sqlite.core.DB.throwex(DB.java:1150)
at org.sqlite.core.NativeDB._open_utf8(Native Method)
at org.sqlite.core.NativeDB._open(NativeDB.java:82)
at org.sqlite.core.DB.open(DB.java:216)
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:268)
at org.sqlite.SQLiteConnection.(SQLiteConnection.java:67)

Environment (please complete the following information):

  • OS: Ubuntu, AMD

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions