Skip to content
Advertisement

UnsupportedOperationException with DriverManager.getConnection() on Android

I am unable to connect JDBC to my database, getting following error

JavaScript
JavaScript

Advertisement

Answer

According to the stacktrace, the MySQL Connector/J version you are using is using a java.util.regex.Matcher feature not supported on Android (probably named groups). The workaround is to use a 5.1.x version of MySQL Connector/J instead of a 8.0.x version.

However, you shouldn’t use JDBC from Android applications. It is insecure, and generally badly performing to connect to a database directly. The proper solution is to write a REST service (or other form of webservice) to mediate between your Android application and the database.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement