0

What is the Best way to export a bunch of strings from an android app to a mySQL database?

I've looked all over the place. All over here and all over the internet. I have found a bunch of different answers but nothing really makes sense.

Should I use an AsyncTask or a HTTPclient? I also looked at the Microsoft JDBC database export but that also didn't really make any sense to me. Thanks for any help.

edit: I need to add the data to the mySQL database table.

Mike Eaton
  • 3
  • 1
  • 6
  • What do you mean by export? Do you mean you want to add data from your app to a MySQL db? Are you basically looking for a way to directly connect to MySQL from Android? – Anthony Jul 20 '11 at 19:32
  • yes i need to add the strings to different fields in the database table. So yes i guess i just need to connect to the database – Mike Eaton Jul 20 '11 at 19:34
  • 2
    Looking at similar questions, it seems that it isn't possible. What you'd want to do is post the data to web service (basically a PHp script or whatever) which would then add the data to the databases. Essentially the same as submitting a form on a website. – Anthony Jul 20 '11 at 19:36
  • Ok. That was my back up plan. Thanks for the help. – Mike Eaton Jul 20 '11 at 19:37

1 Answers1

0

You can do it with JDBC connector and JDBC API. I've tested with connector mysql-connector-java-3.0.17-ga-bin.jar and works perfect and fast. You'll need an asynctask for this or a Runnable in own thread to avoid locking UI thread and risking killing your apk.

Check here for an example

Community
  • 1
  • 1
ruhalde
  • 3,521
  • 3
  • 24
  • 28