1

Hi I'm working on an Android App and I'll need to access data (read and write) from an SQL Database, can anyone recommend a good example/tutorial for doing this. FYI, I don't have experience at all with accessing a DB from java. I've only done it through C# .NET in the past.

Thanks in advance for your help. Josh

ps: I'll be setting up the DB, as well. So, if there's a better option than SQL Express for working with Android (I may need to use it with iPhone in the future, as well) feel free to suggest ideas

6 Answers 6

1

Don't expose your database server to the app and thereby the whole world.

Build a .NET web service in front of a SQL Server instance, then build your Android and iPhone apps against the web service.

For local caching you can use SQLite on Android or Apple's Core Data API on iOS.

Sign up to request clarification or add additional context in comments.

2 Comments

can you refer me to an example/tutorial for building a .NET webservice as a front to SQL Express Server, and how I would communicate with that from Android/iPhone?
Any ASP.NET webservice tutorial should work fine against SQL Server Express, it's just a different type of VisualStudio project. Once you have a working webservice, finding a good SOAP/WSDL tutorial for Android/iPhone should be easy. Try Google.
0

Android has SQLite built in, which would be good enough for most things, I'd've thought. I found the Notepad Tutorial to be a good introduction to using SQLite.

Comments

0

SQLite on Android and (if you need synchronization with existing SQL Express server) some RESTful service to synchronization data

You can build your own service or use (well you need to wait for final release) MS Sync Framework 4.0

here is my sample for Android client

Comments

0
  1. The database system supported on Android (and iPhone) is not SQL, it is SQLite; which although it has much the same syntax it is quite different under the hood. So SQL Express may not be so helpful
  2. Try SQLite Browser, this is a GUI for looking at SQLite databases and running queries. There are a number of alternatives such as SQLite Studio
  3. You can copy databases from the device to inspect them, see this answer
  4. If you're going to include your own pre-made database SQLite database with your app, then take a look at this blog post

As for a simple query, I'd suggest you start with the article on Data Storage, then go check out some tutorials such as this one.

1 Comment

Maybe I'm misunderstanding, but I dn't think ur answer is relevant. Maybe my question wasn't phrased correctly. I'm not looking for storage on the device (that much I have implemented already). I need access to a central database not located on the individual phone that stores data for all phones.
0

The Java standard API to access a database is JDBC - it should work on Android, as long as you somehow embed the JDBC driver with it. I believe you should be able to connect to a remote database using it.

However, if you need a SQL database only as a local repository for your application, on the mobile device itself, then the recommended way to do it is to use SQLite and the android.sqlite namespace.

Comments

0

You can use sql database with android.use the JSON code and asp web service or java web service or php webservice(mysql).First u study about JSON code,very simple structure to study.Next u study about webservice using asp .net.Here a link mysql connect to the php web service http://www.helloandroid.com/tutorials/connecting-mysql-database

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.