Forum Academy Marketplace Showcase Pricing Features

Settings parameters for SQL

I am trying to connect to my SQL database to edit the amount of money that a certain user has, specified by user_id. However, whenever I try to run it using the set parameters, I just get an error as shown below. Just wondering if anyone could help?

Thanks in advance!

image
image

1 Like

In the query you should just use a question mark instead of $1, $2 etc. So basically just replace $1 and $2 with ? And the reverse the order of the parameters so wallet is under $1 and user_id under $2.

2 Likes

Thanks!

Oh my God, thank you so much.

This should be in the plugin manual, don’t you think ?

Thanks again,

Michel

You’re welcome :slight_smile:
Guess it could be more clear from the manual. I guess the thinking is that users the use mySql have more coding experience, but not sure.
Btw. its not my preferred method to use the plugin because that way you need to have your database exposed directly to the www (prone to hacking). Best practice is to have a database in a closed of subnet and connect to that via an api, much like bubbles own database is not exposed, but only accessible with their api.

Its much more work of course, but gives you finer control in the end, and a lot more security + you learn some new skills :wink:

Thanks Simon,

Yes this practice isn’t secure. Anyway, I gave up about outsourcing the database, as there are numerous features here that you can’t take advantage of if you do that.

My initial thought was to use the superb Bubble workflow, and using MySQL to be able, later, to develop some mobile app.

But that’s stupid, as I should start the whole workflow process again from scratch.

So I’m relying on Bubble to take care of my entire webapp.

Anyway, would you have some specific source to learn developping some MySQL API ?

Thanks again,

Michel

Bubble is really powerfull, so unless you have a very specifik need, you are probable best of just having everything here. But that doesn’t mean its not good to learn some new skills!

I think it really depends on the platform. I use amazon (AWS) where you could get a 1 year free RDS mysql database when creating a new account. Its pretty hard to grasp at first because aws (as well as azure and google cloud) has a massive amount of information on their dashboards and hundreds of products to choose from, so it is quite overwhelming.

In the aws universe you would have to learn about lambda first and then api gateway. When you have a general understanding of how to access a lambda function through api gateway you could look into vpc/subnet/routetables/security groups which is the system used for separating public and private “stuff”.
With an understanding of VPC’s, you would then place a RDS mysql instance inside a private subnet, in a vpc and connect to the database with lambda. Then you have all the puzzles :slight_smile:

The learning curve is quite steep so its really about taking a couple of steps at a time and not go too deep too fast. If you know some coding already i would recommend AWS CDK as the cdk framework takes care of a lot for you. In general, in the beginning most learning will be done in the browser, but as soon as possible you should transition to manage your infrastructure as code - here it helps to learn Cloudformation, AWS CDK, Serverless framework etc., but dont start there!

For resources, I have spent countless hours on youtube (AWS simplified, Stephane Maarek etc), reddit r/aws, http://forum.serverless.com and on amazons on page where there are many tutorials. For coding in general i like firebase.io (youtube), freecodecamp (web and youtube), Dev Ed (youtube) and programming with mosh (youtube).

1 Like

Thank you so much for your very complete answer, Simon.

I actually pay for a cloud Mysql database at OVH here in Europe, and I built the Database with the Mysql Workbench. But as far as I know, that doesn’t improve security at all (does it ?). I’ll have a look at AWS CDK. In fact, I just gave the plugin full access to this cloud database, and things are ok. I guess that just a password isn’t enough. That would be probably the best thing to do for me : starting learning security.

Michel

Michel

Dont know about OVH but most likely, no. I see you can activate ip whitelisting on OVH which would be a step in the right direction though :slight_smile: (You office/home computer needs to have static ip for that to be practical, and if you connect with bubble, its not practical as their ip’s are not static unless you go to a dedicated plan…)
But in all fairness, dont overthink it unless you have sensitive and/or mission critical data on your db. Make sure your password is good quality and change it on a quarterly basis or so, then you’ll most likely never experience a problem.

1 Like

Thank you Simon.