locked
Postgres SQL database connectivity? RRS feed

  • Question

  • User163695 posted

    I am working with company that primary develops most of their software in a system that uses Postgres SQL in PGAdmin. Is there a way to connect to this database in Xamarin cross platforms?

    I've looked through libraries used in C# ASP.net development (npgql, devart pgsql, etc) but none of those seem to work in a mobile platform. In addition to that, SQLite doesn't seem to support pgSQL.

    Can anyone offer suggestion or help? Thanks.

    Thursday, October 15, 2015 2:13 AM

Answers

  • User87841 posted

    Hi, My suggestion would be having web services as a Middle Man to talk to your app and the database. Once you have a REST API services, you can then call web servies from xamarin apps using RestSharp client. I would say this is the standard way of talking to database hosted on any other platform.

    cheers

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, October 15, 2015 10:23 AM

All replies

  • User87841 posted

    Hi, My suggestion would be having web services as a Middle Man to talk to your app and the database. Once you have a REST API services, you can then call web servies from xamarin apps using RestSharp client. I would say this is the standard way of talking to database hosted on any other platform.

    cheers

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, October 15, 2015 10:23 AM
  • User163695 posted

    I'm used to using this pattern for my PgSQL queries. Is there something to use that closely fits this layout? If not, what would be the best way to get this sort of functionality? I want to be able to enter in SQL statements on the fly

    using(var db = GetOpenDatabaseConnection()){ using(var cmd = db.CreateCommand()){ cmd.Parameters.AddWithValue("MyParameter", 12); cmd.CreateCommand =@" SELECT * FROM mytable WHERE column = :MyParameter "; using(var dr = cmd.ExecuteReader()){ while(dr.Read()){ //assign objects values from result set } } } }

    Thursday, October 15, 2015 5:18 PM
  • User211448 posted

    @LukeRockswold did you ever find a solution to implementing connectivity from Xamarin to PgSQL ?

    Wednesday, May 11, 2016 11:41 PM
  • User163695 posted

    @HalilDoganBolak said: @LukeRockswold did you ever find a solution to implementing connectivity from Xamarin to PgSQL ?

    You have to create a webservice using C# Web API or some other sort of RESTful service that sends JSON strings.

    Thursday, May 12, 2016 11:02 AM