Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid JDBC not working: ClassNotFoundException on driver
    primarykey
    data
    text
    <p>I'm trying to use JDBC in my Android application to connect to a remote database to do inserts, queries, etc. I have successfully connected and done these things in a different JAVA project. So I figured since Android is Java, I could just port over the relevant code, add the same build path for the driver, etc. But it gives me the error: </p> <pre><code>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver </code></pre> <p>I really don't think it's a code issue since the same code works in a Java project (which I just execute in main()). But for reference here it is: </p> <pre><code>String url = "jdbc:mysql://localhost:3306/eventhub_test"; // String user = "root"; String pass = ""; SQLUtils sqlu = new SQLUtils(url, user, pass); </code></pre> <p>//the SQLUtils class I made: </p> <pre><code>public class SQLUtils { private String CONNECTION_URL; private String user; private String pass; private java.sql.Statement stmt; private java.sql.Connection conn; public SQLUtils(String conn_url, String user, String pass) { this.CONNECTION_URL = conn_url; this.user = user; this.pass = pass; } public void init() throws IllegalAccessException, InstantiationException, ClassNotFoundException, SQLException { Class.forName ("com.mysql.jdbc.Driver").newInstance (); conn = DriverManager.getConnection(CONNECTION_URL, user, pass); stmt = conn.createStatement(); } } </code></pre> <p>So I'm really confused here. Does JDBC not work with Android? If so, tell me what alternatives I should look into for remote MySQL database access. </p> <p>Thanks. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload