How to make MySQL Connector/J working on android?

前端 未结 3 1693
心在旅途
心在旅途 2021-01-03 10:54

I\'ve got a MySQL server running on a local Linux machine. I haven\'t been faced to any problems communicating with it and executing SQL statements through a simple Java pro

3条回答
  •  醉梦人生
    2021-01-03 11:34

    The general misconception among Java developers who is moving to Android world is that everything that has been created for old good Java can be used on Android as well. Since Android usage of Java has violated the major Java principle, "write once, run everywhere", it's simply not true. I've seen people trying to use common Apache jars with Android, which resulted to weird errors (see Can't import Apache HTTP in Eclipse).

    The same problems seem to be true for Java JDBC drivers and API's, e.g. see answers here: Connecting to MySQL from Android with JDBC

    The common advice - each time when you try to use a 3rd party JAR with Android, check if it's compatible with the latter or if there is a port, which is specific for Android.

提交回复
热议问题