IOS connection Postgres

Hi! Is it possible to connect an iOS-App to Postgres?
I try

  mDb = New PostgreSQLDatabase

  mDb.Host = "192.168.1.33"
  mDb.UserName = "postgres"
  mDb.Password = "miapassword"
  mDb.DatabaseName = "postgres"
  mdb.Port=5432

but on
mDb = New PostgreSQLDatabase

get an error
Can’t find type with this name

It work in desktop app…

TankYou

[quote=156009:@marco minucci]Hi! Is it possible to connect an iOS-App to Postgres?
I try

  mDb = New PostgreSQLDatabase

  mDb.Host = "192.168.1.33"
  mDb.UserName = "postgres"
  mDb.Password = "miapassword"
  mDb.DatabaseName = "postgres"
  mdb.Port=5432

but on
mDb = New PostgreSQLDatabase

get an error
Can’t find type with this name

It work in desktop app…

TankYou[/quote]

You really want to check http://xojo.helpdocsonline.com/home before coding with iOS. Lots of things have changed. You cannot assume that because something works in Desktop, it will in iOS.

For the time being, there is simply no Postgres in iOS…

ok, tankYou,
you know if there will be in the future the possibility to connect postgres?

At the moment the answer would be “We don’t discuss future plans”

Technically you can now IF you create a middleware application that you can talk to via socket. The middleware app does all the communication with the database server and your iOS app talks to app that’s on the server. This would be a good spot to talk about how easy it is to do these things with Xojo web apps. Not hard, but not trivial either.

I would not expect to see a driver for Postgres on iOS any time soon. Do you really want your mobile phones talking directly to your database server? Generally not a good idea.

sorry I don’t see why it’s not a good idea … a mobile phone is a computer like another.

It’s not a great idea for desktop computers either.

Here’s a simple example. Say you’ve got 10,000 copies of your mobile app that hits your database directly. Tomorrow you introduce version 2.0 and you change the database structure to accommodate all the new whiz bang features but it’s not backwards compatible to all 10,000 mobile phone users. You simply can’t get them to upgrade for any one of a thousand valid reasons.

You may say to yourself this will never happen because I’m smart and I’ll think of all things beforehand. Great. You’re smarter than me and I hope you make stupid amounts of money. Experience tells me, however, that no design is perfect and you will make changes and direct connections to the database require you to manage every client.

Whereas with a middleware application the communication is with the application - not the database. When version 2.0 hits the middleware can handle version 1.0 communication and version 2.0 communication. The API that you built knows which version it’s communicating with and the middleware app does what is appropriate and the only thing you have to change is your middleware application. None of your 10,000 mobile users will require version 2.0. So they upgrade the app to the new version and your middleware app quietly starts giving them the information that version 2 provides.

It’s management of 1 database and 1 connection versus managing 1 database and 10,000 connections. This is pretty much the way the internet works. Direct connections to databases are dwindling because it’s an inherit security risk and you are forced to add a bunch of crap into your client application to handle security. It’s just easier with the middleware application.

You’re absolutely right, a mobile phone is just another computer. Forgetting about security is a sure way to get your data (and your customers data) hacked. And forgetting about the management of all those mobile users is a sure way to get pissed off customers.

I was thinking of postgres for a small business to access their (private) business database
so it’s with limited count of mobile phones.
and so phones that you can upgrade if needed
I don’t know if a postgres database can handle more than 100 simultaneous connections
(with acceptable response times)
and I sure will not try that for now.

as for the database version
you can leave the version 1 online, and make a version 2 new database that version 2 app will handle
version 1 app will only see version 1 database, and version 2 app will see version 1 and version 2 database
same thing almost as if it were a simple app on a"real" computer.

In my case I had only need to query an archive warehouse in local LAN and see the features

I have a pc with postegres to which I wanted to connect to the above question.

I speak of a database connection by up to 10 users with the same procedure in local LAN.

Wondering if there was a way to run it, connect directly to the database or some example to do this in another way.

Thank You

[quote=156227:@marco minucci]In my case I had only need to query an archive warehouse in local LAN and see the features

I have a pc with postegres to which I wanted to connect to the above question.

I speak of a database connection by up to 10 users with the same procedure in local LAN.
Wondering if there was a way to run it, connect directly to the database or some example to do this in another way.
[/quote]

Why not connect to the database with your PC and use a ServerSocket or a Web app on it to provide a web service for the portable device ? If your iOS device accesses the same lan through Wifi, it has access to the serversocket or web app.

You still want to secure your web app to prevent unauthorized access, but that will work.

Hello,

Do I need always make a middleware app to connecte an iOS app made with Xojo at PostgresSQL Database ?

Regards

Arnaud

Yes Arnaud