It is currently Sat Dec 07, 2019 1:55 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Cloud database?
PostPosted: Sun Dec 09, 2018 8:22 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Mar 27, 2009 9:41 am
Posts: 744
Location: Athens, Greece
Is there a way to have a cloud database used by Windows app? I tried to use Firebase but it seems to be available for mobile devices only. Is there any solution for Windows? If not, could a simple sqlite file be stored somewhere on the web and accessed from my app using PB's integrated SQL support?


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Sun Dec 09, 2018 10:12 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Fri Apr 25, 2003 4:34 pm
Posts: 918
Location: Canada
doctorized wrote:
Is there a way to have a cloud database used by Windows app?


Sure.
In it's simplest form, set up a MariaDB/mySQL or PostgreSQL server somewhere.
Then use PB database commands to access it directly...
Code:
OpenDatabase(0, "host=mydomain.com port=5432", "dbname", "password")


Of course if you want security, better to use this method through a tunnel (SSH).
If you also want to set up your own web server where your database server is located, you can then create a CGI app which talks locally to the database server and the CGI app is the middleman between the database and your main app.

Guess it all depends how involved you want this to become ;)

_________________
Image Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Mon Dec 10, 2018 10:17 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 22, 2003 7:43 pm
Posts: 461
Location: Germany, Saarbrücken
Do not connect directly to an external database server unless you know exactly what you are doing or the program will never be publicly available. To connect to a database server you need credentials and you can never hide these credentials that good in your executable that nobody can read them. If someone else extracts the credentials from your executable he basically can do all of the things your application is able to do or more. It depends on how well you configured your database server.
Always develop a server side service which is the only one that has access to the database server and provides an API which can be called from your application. The API should only be accessible from someone who had registered to use your application so you can exactly manage which calls he can make to the database.

_________________
Electronics, Crazy & Interesting Stuff, all that with text, image and sound? Click here!

The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Mon Dec 10, 2018 11:08 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Mar 27, 2009 9:41 am
Posts: 744
Location: Athens, Greece
Here is the point. I have some co-workers to share some data and I want a database somewhere in cloud so the data can be available wherever they are. Everyone will have his own user name and password to access them. I know that the best way is to have the base somewhere stored and a web service to read/write. Then, my app will communicate with that service using TLS. I do not know hot to implement something like that and I do not have the time to do it. I cannot spend money to buy a solution so I am asking for something "ready" like Firebase. Unfortunately, the devices will be desktop and laptop computers and not tablets or smartphones to create android app.


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Mon Dec 10, 2018 11:49 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 22, 2003 7:43 pm
Posts: 461
Location: Germany, Saarbrücken
Why not using a normal database browser like DBeaver or DB Browser for SQLite or something similar then? If you define strong passwords for every user and use some SSL tunnels that would be the simplest solution.

_________________
Electronics, Crazy & Interesting Stuff, all that with text, image and sound? Click here!

The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Mon Dec 10, 2018 1:52 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Mar 27, 2009 9:41 am
Posts: 744
Location: Athens, Greece
NicTheQuick wrote:
Why not using a normal database browser like DBeaver or DB Browser for SQLite or something similar then? If you define strong passwords for every user and use some SSL tunnels that would be the simplest solution.
As I saw, the second one just creates and edits the db, right? The first one does pretty much the same or I understood wrong?


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Mon Dec 10, 2018 6:35 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jul 03, 2003 6:53 pm
Posts: 1281
Location: England
doctorized wrote:
Here is the point. I have some co-workers to share some data and I want a database somewhere in cloud so the data can be available wherever they are. Everyone will have his own user name and password to access them. I know that the best way is to have the base somewhere stored and a web service to read/write. Then, my app will communicate with that service using TLS. I do not know hot to implement something like that and I do not have the time to do it. I cannot spend money to buy a solution so I am asking for something "ready" like Firebase. Unfortunately, the devices will be desktop and laptop computers and not tablets or smartphones to create android app.

You can use a regular hosting service and PB's CGI + JSON commands to create an API. SpiderBasic will be best for the client UI because then it won't matter whether client devices are desktops, laptops or tablets.

I like 4uHosting in the UK because they let you create and access folders above the root folder your website is served from. That means you can put files (e.g. your SQLite database) somewhere you can be sure the webserver won't serve them up but your CGI programs can still read and write to them.


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Mon Dec 10, 2018 8:03 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Mar 27, 2009 9:41 am
Posts: 744
Location: Athens, Greece
the.weavster wrote:
You can use a regular hosting service and PB's CGI + JSON commands to create an API. SpiderBasic will be best for the client UI because then it won't matter whether client devices are desktops, laptops or tablets.

I like 4uHosting in the UK because they let you create and access folders above the root folder your website is served from. That means you can put files (e.g. your SQLite database) somewhere you can be sure the webserver won't serve them up but your CGI programs can still read and write to them.
In other words, you mean that I can use Spider Basic to create the client UI and not a Windows app. My biggest problem still exists, the creation of the web service. I know that it must have two functionalities, authentication and read/write to the db.


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Tue Dec 11, 2018 9:42 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jul 03, 2003 6:53 pm
Posts: 1281
Location: England
doctorized wrote:
My biggest problem still exists, the creation of the web service.

the.weavster wrote:
You can use a regular hosting service and PB's CGI + JSON commands to create an API.


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Tue Dec 11, 2018 3:46 pm 
Offline
User
User

Joined: Sun Nov 23, 2014 1:18 pm
Posts: 32
...you could simply try https://www.obvibase.com/
No need for setting up services... simple access by web browser.


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Thu Dec 13, 2018 10:03 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Mar 27, 2009 9:41 am
Posts: 744
Location: Athens, Greece
the.weavster wrote:
doctorized wrote:
My biggest problem still exists, the creation of the web service.

the.weavster wrote:
You can use a regular hosting service and PB's CGI + JSON commands to create an API.
Sorry, but this answer is not clear enough for me. Where is that "regular hosting service"? The API mentioned will be in the that service?


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Fri Dec 14, 2018 3:23 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jul 03, 2003 6:53 pm
Posts: 1281
Location: England
doctorized wrote:
Sorry, but this answer is not clear enough for me. Where is that "regular hosting service"?

As if you were going to put up your own website, like this. Just make sure whichever hosting service you choose includes support for CGIs. I also prefer hosts that let you access folders a level above your web root so you can put files out of reach of the web server but still within reach of your CGIs.

doctorized wrote:
The API mentioned will be in the that service?

You can use PureBasic's CGI commands to create the API. Once compiled your CGI executables are put in your website's cgi-bin folder.

Let's say you register the domain "yourdomain" for your website, you create a CGI named "yourcgi.exe" and upload it to your cgi-bin. Then you'd send data to it by making a POST httprequest to:
http://www.yourdomain/cgi-bin/yourcgi.exe

If you're making the POST request from a web page hosted on your domain you only need the relative path:
/cgi-bin/yourcgi.exe

If you use SpiderBasic to create the UI you can serialize any data you want to exchange between the SB client and the PB API as JSON.


Top
 Profile  
Reply with quote  
 Post subject: Re: Cloud database?
PostPosted: Fri Dec 14, 2018 4:49 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 22, 2003 7:43 pm
Posts: 461
Location: Germany, Saarbrücken
Most of the servers out there are running Linux. So you CGI script should also be a Linux executable, not a Windows executable. Also you need to know if it is an x86 or x64 kernel and which libraries are installed on the server so you can use the purebasic libraries you need, for example sqllite libraries.

_________________
Electronics, Crazy & Interesting Stuff, all that with text, image and sound? Click here!

The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Majestic-12 [Bot] and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye