Welcome! Log In Create A New Profile

Advanced

[WM] PostgreSQL database

Posted by IsmirB 
[WM] PostgreSQL database
October 05, 2019 02:35PM
Hi to all.
I was create small IOS project with just one table
1. Customer HF Classic and also same table for test converted into C/S
Then I was create project for xCode, import into MAC PC , generate application.
Run into emulator on MAC and all work fine. I can see data from server installed on Windows 10 PC.
Also all work with data from application deployed on IphoneX. Everything work fine.

Then I create PostgreSql database with PgAdmin on Windows 10 PC.
Windev Mobile has no Native connector for PostgreSql database. There is support for only HF, HF C/S, HFSqlDrive.
But, connection is possible trough SQLConnect() and Sql.xxxx commands().

ConnectionNum is int

ConnectionNum = SQLConnect("192.168.1.100", "user", "password", "DatabaseName", "PostgreSQL")
IF ConnectionNum <> 0 THEN
ToastDisplay("Connection Successful")
ELSE
SQLInfo()
Error("Connection to database has failed." + CR + ...
"Error code: " + SQL.Error + CR + SQL.MesError)
END

SQLDisconnect()

Emulator from Windows 10 for IOS can not connect into postgreSql database.
Then I was copy wd240postgresql.dll into EXE folder of this project. Everything work fine. I can connect and use data.
IOS application, emulated on Windows 10 PC can make connection and work fine with PostgreSql database.

After generation and test I was transfer "Test_IOS.xcode.gen" application on MAC PC into xCode.
I start build application, run, application is started, but application can not connect into PostgreSql database.
Emulator on MAC or IphoneX can not connect into database.

I know I must have some connector for connection because wd240postgresql.dll can not be used for MAC OS.
I hope somebody have experience with this situation and can help me to make connection successful.
OR maybe there is solution for MySQL database.

Thank you in advance.
ICI
Stefan
Re: [WM] PostgreSQL database
October 06, 2019 03:52PM
Hi ICI,

I woul not access directly a database from a mobile device, as you need to handle timeouts due to lost connection (no mobile network available) and the most important thing, if you connect directly to a database through internet no need to open a port on your server, which might be a big security issue.
Every hacker scanning a server would scann the common database ports an try to hack your server.

So I would recommend to create a webservice (I use soap services) and let the mobile device consume the webservices.

I do it in that way:
I let consume the webservice in a separate thread and store the data comming from the service in a local DB on the device.
So the usere does not recognice long response times through to bad internet connections and have a fast access to the local database.

Regards

Stefan.
Re: [WM] PostgreSQL database
October 06, 2019 05:33PM
Hi Stefan.
Thank you for your response.
I don't know how to create webservice. Is there any good tutorial ?
If I understand any of this, webservice with web application server must be installed on some server in company so it can be used from mobile devices. ?

CASE.
If PostgreSql database is on some web domain or server which is not in company is it possible to communicate with database?
Where I need to install webservice ? On Some PC wit windev so it can consume webservice?

Your CASE
What type of database you use on device. HF or SqlLite? I try to achieve this with IOS (device is IphoneX) and MacBook Air.
What would you recommend ?

Best regards !
Re: [WM] PostgreSQL database
October 06, 2019 07:00PM
Hello ImirsB

Question?
As far as Direct connect vs webservice if you host the webservice yourself either way you are opening a port if the DB resides on your server?

I see the point of connection loss it can be an is a issue that will cause damage to the DB during writes.



Different Note:
I just started to create my first webservice with Windev it is easy to get started do not know the pitfalls yet, others can tell you.

Yes your webservice could connect to any db even if it is not on your server. Just like windev connection on the fly.

I use HF on my devices had good luck so far.

DW
Re: [WM] PostgreSQL database
October 07, 2019 10:12AM
cabinetman Wrote:

> Yes your webservice could connect to any db even
> if it is not on your server. Just like windev
> connection on the fly.

First , thank you for your whole answer. I hope I will also find the way to create webservice.

Part of your answer was this above. So, Iphone or iPAD must connect into webservice on my local server first
then local server/webservice must redirect on server where database is.???

Best regards !
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: