How to connect to web database

For questions about Gambas web tools.
Post Reply
bill-lancaster
Posts: 186
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

How to connect to web database

Post by bill-lancaster »

My website has a database which I would like to access using Gambas.
It's a mysql db but I can't get the right settings to make a db.connection
Any advice would be appreciated
User avatar
cogier
Site Admin
Posts: 1117
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: How to connect to web database

Post by cogier »

Hi Bill,

I have not mastered DB but there is an example in the Gambas Farm called 'DataBaseExample' that might help.
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: How to connect to web database

Post by stevedee »

bill-lancaster wrote: Friday 23rd November 2018 5:42pm...It's a mysql db but I can't get the right settings to make a db.connection...

Can I see your code? I haven't used mysql either, but I used sqlite3 a few years ago, and it didn't seem too difficult.
bill-lancaster
Posts: 186
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: How to connect to web database

Post by bill-lancaster »

Thanks for the responses, I've been learning a bit out web based databases. First, it seems that to use mysql commands over the internet is a very insecure thing to do, then I discovered that my web service provider does not allow access the the database anyway! I've been using mysql with local databases for some time now but have never tried to access a remote database.
As to my code, it was just a question of getting the right values for User Name, Login, Port and Password correct but this is the wrong approach to solving my problem. I'm should be able to write code that would run on the website and access my local database.
User avatar
Got2BeFree
Posts: 91
Joined: Saturday 26th November 2016 2:52am
Location: Lost

Re: How to connect to web database

Post by Got2BeFree »

Since I run my own dedicated, off-site server I can open up access to my databases. When I do do this, I make sure it is accessible only to my remote (home) IP address. I know this doesn't help you in your situation, but I just wanted to throw this out there.

Also, make sure any code you use on your website to access your db is secure. Hackers can exploit bad code for SQL injection.
sholzy

I'm wondering around lost in the past, not knowing where the present is.
Post Reply