error CANON_EQ flag not supported in Android app

  Kiến thức lập trình

I’m trying to connect to a MariaDB database from an Android app. The connection is established, but I can’t execute a query to the database because I get an error “java.lang.UnsupportedOperationException: CANON_EQ flag not supported
when executing line statement = connection.createStatement();

...
import org.mariadb.jdbc.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import org.mariadb.jdbc.Statement;
...
Connection connection = null;
Statement statement = null;
...
connectButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                final String url = "jdbc:mariadb://" + db_address + ":" + String.valueOf(db_port) +
                        "/" + db_name;
                try {
                    Class.forName("org.mariadb.jdbc.Driver");
                    connection = (Connection) DriverManager.getConnection(url, db_user, db_password);
                    tv_info.setText("Database connection established");
                    System.out.println("Database connection established");
                    statement = connection.createStatement();
                } catch (Exception e) {
                    System.out.println(e.getMessage() + " ///////////////////////////////");
                    tv_info.setText("Database connection not established");
                }
            }
        });

Please advise how to solve the problem.

New contributor

YeS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

LEAVE A COMMENT