How can I connect to a MySql database?

silver060silver060 Sarah TantiMTMember

I'm developing an android app with Xamarin Studio however I cannot cannot to a MySql database using MySql.Data.dll
Does anybody know how I can do this?

Thanks

Answers

  • JonathanPryorJonathanPryor Jonathan Pryor USModerator, Xamarin Team Xamurai

    Xamarin.Android does not include a MySql.Data.dll, so you would need to build it from source against the Xamarin.Android profile assemblies.

  • stiven.2124stiven.2124 stiven USMember

    How can I use SQlite with xamarin such as JAVA and where it's the db storing?
    thanks

  • SKallSKall Sami M. Kallio USMember ✭✭✭

    Another option is to use ORM libraries such as SQLite.NET and ServiceStack.OrmLite. The benefit for ORM is that the code is reusable (OrmLite code can be used on other databases as well, such as SQL Server). Dapper might also work on mobile although I have not given it a try.

  • wallymwallym Wally McClure USMember, Insider, Beta ✭✭✭
    edited December 2013

    To talk to a mysql db, i would recommend building a web service that allows you to talk to your database over http. There are too many issues trying to talk over non port 80 over the internet. Return some json or xml from your web service and you should be good to go. I like WebAPI to do that.

    There is some provider that I read about back in 2010 that had been compiled to run within Xamarin.Android/iOS. It might be something you can use, but I would recommend against it.

  • wallymwallym Wally McClure USMember, Insider, Beta ✭✭✭

    To get at Sqlite on the device, there is a sqlite ado.net data provider that you can use. It is built into Xamarin's tools.

Sign In or Register to comment.