Db database connection doesn't allow direct database connection

OK, I have tried it again.

The target has as Database: None

The direct database connection works fine:

I have created a new page called register and the server connect action is pointing to api/insert

Yet, I get the following error when I submit the form to insert the information in the database:

You can check it in the following public address:

http://159.65.226.41:65/register

For the sake of complete reporting, the code looks as follows:

Hi Jay,
The database connection settings you took a screenshot of is the Direct connection. This is used by the Wappler UI to gather schema and for the Database Manager connection. The connection you need to be checking is under Server Actions > Database Connections

This is the connection used by server-side scripts to connect to the database.

I don’t have the same options you have in my UI, see below:

Hence, I can’t test the connection that way

Sorry, I was working on a PHP project for my connection screenshot, it seems there’s a difference between PHP and NodeJS for that one.

One thought is that you have SSL selected. Can you deselect that, save and republish?

With SSL deselected:

I get the following error:

In other words, deselecting SSL has no effect

What is the literal sql query sent through your database connection?

$sql = "INSERT INTO myform ( firstname, lastname )

VALUES
( ‘Joe’, ‘Biden’ );";

or

INSERT INTO myform (first_name,last_name) VALUES (Joe, Biden);

Hi NewMedia, please see below the sql query sent:

I don’t think this is to do with the query, the connection timeout suggests that the connection parameters aren’t correct. Have you tried connecting with MySQL workbench with the same host, user, port & pw?

The other thing to check is that there isn’t some firewall/access list with DO that limits access to the DB from certain hosts/IP addresses.

OK, I have created a workbench connection with exactly the same parameters I use for the DO Wappler connection and it works OK, see:

And I can insert with workbench a new record in the DO remote database:

If I refresh the schema in Wappler I can view the record I just input:

So Wappler can access the record I inserted in the database through Workbench. But through Wappler I can’t insert the record in the database, I get the timeout error.

Can you check on DO that you have the server address as a Trusted source?

(or that it’s open to all sources)

OK, I have included, as a trusted resource, the DO’s suggested IP of my computer:

but if I try to insert a new record in the database, I still get the timeout error:

The trusted sources needs to include the IP of the target server too. That’s what’s trying to connect to update the DB

2 Likes

Would that be the ip address of my droplet that serves as my public address?

It’ll be the 159.65.226.41 one that the web server uses

It worked!!!

bpj, I just put you in my short list of friends.

Best.

Jay

2 Likes

YEP. So many knobs & dials to twiddle with manually.
& so many external sources to manage to the nth degree when developing in today’s app technology resources.