Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connect MySql to Android

 
Terence Gronowski
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to synchronize the internal Sqlite Database to an external MySQL Database (I work with Eclipse).

I imported mysql-connector-java-5.1.13-bin.jar into the project, but the conversion to another Format (davlink) does not succeed.



Somebody have an idea?
 
Dave MacLean
author
Ranch Hand
Posts: 49
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I'm correctly understanding what you're trying to do, the problem is with "localhost". You're trying to connect to the external database from within your Android environment. Android is running Linux underneath, so you've got an operating system there, and localhost to that OS means the Android device. What your code says to do is open port 3306 on the Android device. You'll need to give the IP address of your external host to connect to it from Android.

- dave
 
Terence Gronowski
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave thanks

I run It with the Emulator on the one same machine. I indeed have to specify the IP of my PC there as for Android the Emulator is "localhost". But that is not the main problem. There is an error message "Conversion to Davlink format failed with error1". I supose this is the error which is caused because the compilation fails when i should rework "mysql-connector-java-5.1.13-bin.jar" into the Davlink format.
 
Satya Komatineni
author
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Terence,

One can certainly include externally build jar files by other java compilers in to android.

Here is a research link for this topic

Externally built jar files and Android

However you must see what other java jar files those may further depend on. Also the android java sdk is a smaller subset of the full java sdk. So if the external jar is using some classes that don't exist in android jar then they will fail.

Hope this is of some help

Satya

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic