2

Is it possible to create a content provider for a different database like MySQL or SQL. How can I achieve this? Any suggestions?

4 Answers 4

2

ContentProvider can be applied to any kind of data even not SQL one. If you know how to get connection to MySQL (not easy task) - you can easily implement your own ContentProvider over MySQL data - just create your own class extending ContentProvider - and you're there.

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

3 Comments

This says it all as well. +1
@barmaley do you have any example for reference?
RTFM: Remember that you don't have to use a database to implement your repository. A provider appears externally as a set of tables, similar to a relational database, but this is not a requirement for the provider's internal implementation.
2

If you want to expose the data to your another app you can use content provider. Otherwise it is not needed.

Comments

1

This is not possible to use android content provider for different database.Please have a look at Does the content provider allow for MySql synchronization?. As Android doesn't currently include support for automated MySql server synchronization.

The Alternate Option

Content provider can be applied to any kind of data even not SQL one. If you know how to get connection to MySQL (not easy task) - you can easily implement your own content provider over MySQL data - just create your own class extending content provider - and you're there.

But As currently Android content provider or resources are not available to connect or create content provider which can be able to server synch.

Comments

0

Unfortunately, Android doesn't have too much support for MySQL unless you have a web server. As far as SQL Server, there may be some classes that are available for you to use but many of them are targeted at ASP.NET and Microsoft-based platforms. This page practically says it all.

7 Comments

Thnx for reply but I need example URL or demo code. You know how can I connect mysql sample table with android content provider?. I know simple android-mysql database connection but here I need this connection to be happen with content provider.
Do any of the links I provided you with not have the code you're looking for?
no..I have already done content provider with sqlite. Now I need it with mysql or other database.
I have found this website. See if this helps.
I think you are not able to understand what I need. This all link have simple mysql-android connection without extending content provider class. I want example with Content provider(A class which extends content provider but in its oncreate() we can connect MYSQL or Other database) not android SQLite or not the simple database connection.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.