JetBrains / JetBrains/Exposed

SQLite Android status

Open
#578 7 comments 20 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
9.3k
Forks
798
Avg merge
4d 2h
Merged PRs (30d)
26

Description

I may be mistaken but, no JDBC driver works for SQLite on Android, which means no SQLite Exposed on Android.

Here's a list of issues related to that problem:
- [Android `UnsatisfiedLinkError`](https://github.com/xerial/sqlite-jdbc/issues/248)
- [`IllegalArgumentException` when trying to create tables](https://github.com/JetBrains/Exposed/issues/315)

[SQLDroid ](https://github.com/SQLDroid/SQLDroid) is out of question since the jdbc postfix is not one of the [registered here](https://github.com/JetBrains/Exposed/blob/f7286d759cc88e8a751c86eb65709aad6b6d4b17/exposed/src/main/kotlin/org/jetbrains/exposed/sql/Database.kt#L157), unless adding something like:
```kotlin
registerDialect(SqlDroidDialect.dialectName) { MysqlDialect() }
```

Anybody has a solution so far? I was happy to try Exposed on Android as well to replace Room but so far no success 😢

Digging a little deep I noticed that the problem resides in the `metadata.url` in the `Database` class [here](https://github.com/JetBrains/Exposed/blob/f7286d759cc88e8a751c86eb65709aad6b6d4b17/exposed/src/main/kotlin/org/jetbrains/exposed/sql/Database.kt#L30). `metadata.url` returns `null` instead of the actual URL and since everything is evaluated lazily the error message gets a little confused. This happens with the SQLDroid drivers as well and I was not able to figure out why 😕

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.