Connecting SpiderBasic with PostgreSQL (and maybe PureBasic)

Just starting out? Need help? Post your questions and find answers here.
xaby
Posts: 9
Joined: Sun Dec 17, 2023 3:03 am

Connecting SpiderBasic with PostgreSQL (and maybe PureBasic)

Post by xaby »

Hello dear community,
I am a long time user of PureBasic and wanted to do some database stuff. Was starting in PureBasic and like the Gadgets and GUI and so on.
So I also wanted to have these Gadgets in the browser. So I am using SpiderBasic. And when I was trying to use the database connection, I only could use SQLite.

I found here a post, that it is somehow possible to use SpiderBasic as frontend client and maybe PureBasic for the server.
viewtopic.php?p=7253&hilit=postgresql#p7253

I need to have a PostgreSQL database on the server side.

I read something about CGI and authentification ... puh. I wanted to have a simple application, where users can have there own profiles and maybe write messages with eachother e.g. for lerning purpose.

I wanted not to use PHP or ASP.NET, but wanted to use as many PureBasic / SpiderBasic as possible or necessary.
I stuck a bit in a head.

When I searched for PostgreSQL and web-application, something like this was in the search results: https://budibase.com/

In my mind, I have a nice window application, with images, string-gadgets and buttons and stuff, like I would have as a "fat" client on a Windows operating system, but now it would run in any browser.

How do I connect the web based SpiderBasic thingly with something outside the browser and how do I make that secure?

Thanks for help. ... oh and do there exists user libs or includes which have commands for something like that?
Thanks again for help.
plouf
Posts: 295
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

Re: Connecting SpiderBasic with PostgreSQL (and maybe PureBasic)

Post by plouf »

While it is theorically possible to do a websocket http connection to a postgre server with websocker driver (untested)

The most easy and flexible way is to interact via a server side client, php to be the easiest

Writing your own cgi client like paul did, in PB is also possible not easier thought
Christos
xaby
Posts: 9
Joined: Sun Dec 17, 2023 3:03 am

Re: Connecting SpiderBasic with PostgreSQL (and maybe PureBasic)

Post by xaby »

The idea is, to have a "PureBasic"ish pipeline. If there is somewhere PHP involved or Pearl or what ever, the question would be, why not changing the complete project or language. So the idea is also, not rely on other stuff. To have easy maintenance.
xaby
Posts: 9
Joined: Sun Dec 17, 2023 3:03 am

Re: Connecting SpiderBasic with PostgreSQL (and maybe PureBasic)

Post by xaby »

I have problems to start the CGI-exe. Copied it into the cgi-bin folder. But not sure, why it will not be found.
Starting in https://127.0.0.1/cgi-bin/name-of-the-exe

nut sure, if it is a right problem or something else.
User avatar
Paul
Posts: 210
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:

Re: Connecting SpiderBasic with PostgreSQL (and maybe PureBasic)

Post by Paul »

If you are using 127.0.0.1 this tells us you have a web server set up on localhost but you don't say what web server you are running or if you have the web server set up to run EXE's from the cgi-bin folder.
xaby
Posts: 9
Joined: Sun Dec 17, 2023 3:03 am

Re: Connecting SpiderBasic with PostgreSQL (and maybe PureBasic)

Post by xaby »

Yeah ...
I tried to use XAMPP on Windows 11 Pro.
I copied the EXE file into the XAMPP/cgi-bin/ folder
and 127.0.0.1 will direct to the XAMPP/htdocs/ folder

maybe I have to use ../ or nothing

Also I am not sure, if I set everything correctly for the rights to use EXE files.
I changed in some PHP configuration some # stuff, but I guess, that has nothing to do with it.

I am running Apache from the XAMPP control panel.

I am not sure, if the SpiderBasic "server" runs in parallel and has some other folder configurations. So yeah, I am still stuck in the simple configuration.
And try to have a setup localy that SpiderBasic can use PostgreSQL later (SQLite for now) via CGI.

Do I have to change or add anything into a cgi.cgi file in the cgi-bin-folder? Puh. I am so stuck :roll:
User avatar
Paul
Posts: 210
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:

Re: Connecting SpiderBasic with PostgreSQL (and maybe PureBasic)

Post by Paul »

For simply testing on a local computer I would use something like CivetWeb
https://github.com/civetweb/civetweb/releases

It's about 1MB and doesn't need to be permanently installed, just run the EXE
You can set any folder to be the ROOT web folder and you can put the cgi in that same folder, just compile it with the .cgi extension instead of .exe

Maybe that will get you going a bit quicker?
User avatar
useful
Posts: 135
Joined: Tue Feb 25, 2014 1:15 pm

Re: Connecting SpiderBasic with PostgreSQL (and maybe PureBasic)

Post by useful »

2B or not 2B = FF
xaby
Posts: 9
Joined: Sun Dec 17, 2023 3:03 am

Re: Connecting SpiderBasic with PostgreSQL (and maybe PureBasic)

Post by xaby »

You are so helpful. Thanks a lot.
Have to look into it. Because of Christmas and New Year ... but first week in January I will build a small project.
Also the template thingly is very interesting.
Was thinking if I have to switch to Microsoft Entity Framework for .NET ... but I guess, SpiderBasic and PureBasic in combination could be something for a nice prototype.

Not sure, how to make the user-access. I guess, doing it from scratch would have potential for security gaps.
Post Reply