New here. Question about possible internet db updates?

Everything else that doesn't fall into one of the other PB categories.
User avatar
the.weavster
Addict
Addict
Posts: 1537
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Re: New here. Question about possible internet db updates?

Post by the.weavster »

If you create a JSON-RPC API as I detailed above SQLite will be fine but put the db file in a folder above the root directory that web content is served from. If you want to share a SQLite database the key is to create some kind of application server that exposes an API and which is on the same physical drive as the SQLite database. Client applications then consume the API rather than touch the database directly.
HoosierDaddy
User
User
Posts: 14
Joined: Wed Nov 23, 2022 12:51 am

Re: New here. Question about possible internet db updates?

Post by HoosierDaddy »

Thank you so much. I will study all this and I appreciate your help very much.

Tim.
KosterNET
User
User
Posts: 30
Joined: Tue Mar 22, 2016 10:08 pm

Re: New here. Question about possible internet db updates?

Post by KosterNET »

Hi there Tim,

Welcome to PureBasic :) I am using it for a while and i LOVE it. Hope you will enjoy it as much as I do.

If I understand well you want a program to connect to a server on the Internet and do CRUD-tasks on a database on this server?

Is there any reason you would want the server-side to support HTTP(s)? Especially when you do not want anyone to be able to access via a other programs (web-browser, wget, ...), this might not be nesessary. On the other hand, https takes the encryption off your hands.

It is also possible to have PureBasic communicate over the internet directly. You can create a server-app that runs on the server. No webserver needed. The server-app just listens to a port and connects to the database.
On the other side you can create a client-application that shows forms and connects trough IP to the listening server-app.

You will have to think about authorisation and encryption yourself, but this would completely eliminate the need for a webserver.

If you might want to use a webserver, have a look at abyss webserver from aprelium. I am using it succesfully with PureBasic. It is small, quick and can be expanded to a multi-host-system complete with Let'sEncrypt certificates etc.

For me it was quite a step from VB-programming tot PB, but now I do not want anything different anymore ;-)
HoosierDaddy
User
User
Posts: 14
Joined: Wed Nov 23, 2022 12:51 am

Re: New here. Question about possible internet db updates?

Post by HoosierDaddy »

Thank you so much for the reply. I will check out the web server. Unfortunately, I use a hosting service, or will be with the database and wouldn't have the necessary root permissions to install a listening app on the web server. So whatever I use needs to be able to communicate over the internet and insert, update, etc, the DB. The web server will just serve up the PHP pages to allow customers of my client to see their services and prices. It's my client that needs access to the DB without a web frontend. Hence the reason I wondered if PB could connect using the Internet to the hosted Database. I was thinking I built an app long ago in Microsoft access that connected to SQL server hosted on a web hosting database. It worked fine in that I just pointed at it with the DSN or ODBC via the IP addy and username and password. It seems I should be able to connect in a PB front end the same way??? I would use https if possible or ftps. etc..
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: New here. Question about possible internet db updates?

Post by Marc56us »

Hi,

The databases on the basic offers of the hosters usually only accept internal connections (localhost / 127.0.0.1) so you will have to go through PHP (or some others languages if exists).

They also usually provide direct access for management via a web interface (i.e: phpMyAdmin)

That's all. No direct access, even in ODBC. Security reason.

If you want to create your own application, then you have to go to a higher offer where you rent a space or a complete virtual / physical machine. In this case, you also have to manage the installation of the database, backups and sometimes the operating system.

If you don't need much concurrent access you can also host yourself (a mini PC or RPI consumes 10W and provides as much power as a server from a few years ago).
There you just have to do an address translation on the box to access the database remotely with your PB application.

:wink:
Post Reply