Updating working database connection to work with recent Wappler changes

From the beginning, I’ve never had any problems with database connections in Wappler. I always set up my local and remote database in the same way and have always been able to switch between the two, using a single connection. Also, I don’t use the Database Manager. For these reasons I’ve never paid much attention to the various discussions regarding connection issues and new features.

Previously, when working with server connect, it didn’t matter whether I had the target set to local or remote. Now, if the target is set to remote and I edit an existing query, I get:

image

Nothing appears in the dropdown list. I thought there was a chance the database tables might be updated if I clicked update, but:

image

I don’t know if this matters - I can just leave the target to local - but I wonder if there are any potential problems. I think it may have something to do with:

image

I don’t think this is covered in the documentation. I have vaguely noticed this option cropping up in discussions, but never having any connection issues, I didn’t take much notice.

Can I just ignore these messages and just keep the target to local when editing APIs? I frequently use the ‘open in browser’ option when working on APIs and certainly want to switch between local and remote to see the output, but strangely this works fine. Or should I update something and perhaps create new targets with different settings? (Perhaps I should read the documentation, althougth I’m not sure if these new options are covered - or I may have looked out some old documentation).

I use PHP/MySQL with WAMP. (I’ve tried Docker, locally, but am quite happy with WAMP.)

I would be very grateful for any suggestions. (I’m sorry if these are rather basic questions.)

Hey @TomD,

From reading your description of the issue, I am assuming that you have experimental features turned on.

I have never seen that pop up before, so that is interesting. :slight_smile:

Even though you do not use the Database Manager feature, it might be worth while to setup your database connections as Teo outlined in

That might prevent the pop up from showing up.

Nothing basic about the question. It is an interesting scenario.

By the way, have you seen my questions? LOL :slight_smile:

Thanks @scott

Yes, I have experimental features turned on. I haven’t seen these pops up before either and they suggest something is not as it should be.

Thanks for the link. That probably what I’m looking for. Perhaps I’ll have to do some homework. I think I’ll have to do some running in order to stand still in relation to connections. As I mentioned, they’ve always just worked and I’ve never given them a second thought after setting them up.

I always read your questions - even if I don’t alway pay enough attention :slightly_smiling_face: Which questions are you referring to? (Though I’m signing off for today now.)

These pop ups were added sometime ago and are not related to the new globals changes that are in experimental mode.

This just simply mean the DB schema Wappler had earlier, when creating the particular query, has now changed.
You should check if both dev and prod dbs have same schema and then, use either the db connection step to save the connection again (which refreshes schema with Wappler) or use the db manager to refresh the schema.

For NodeJS, schema can be refreshed only via db manager.
Now with globals stuff, I think it applies to all server models.

2 Likes

Yes this means that the schema for your remote database isn’t loaded. This is because we keep the schema and connections per target.

It is a bad idea to work directly on remote production target as you might break things on your live site without testing first on a local dev site.

Anyway I will check why the schema isn’t fetched automatically for the remotes any longer.

1 Like

I agree - I never do that. That’s why it was convenient before: I could have either target selected and still work with APIs in server connect and test the results in the browser etc. Anyway, it’s not a big problem.

Sorry - I see what you mean. I think you ask a lot of good questions. I expect I shall be coming back to some of them when I take the plunge like you and do battle with NodeJS.

1 Like

Not to get off topic here, but Wappler with nodejs has a lot of time saving features.

Some of the time saving features are:

  1. The use of layouts/content pages versus server side includes.
  2. The auto creation of routes when a page is created versus having to manually create the routes.
  3. The use of additional npms to create email templates based off a file created in Wappler.

That’s not an inclusive list, just my basic observations from converting a php site to a nodejs site. I’m still trying to work my head around some of the more advanced things that can be done like the server side scheduler instead of using a cron.

Sorry just a little nodejs plug there…lol…back to solving the database connection issue.

1 Like

I expect I just hadn’t seen them before, not previously having the database connection issue. I can see they’re useful to warn you about a new table etc, but in this case, the behaviour seems odd - or not what I would expect. I can view the correct output in either target (using ‘open in browser’), so it seems surprising that Wappler reports, incorrectly, that the table doesn’t exist when using query builder.

I haven’t noticed this yet. It seems a slight inconvenience compared to being automatic, but not much of a problem; sometimes it was necessary to update schema changes in query builder anyway (the options to do this are still there).

In the past everything has worked very well and easily: a single connection (which I may have set up two years ago), has been sufficient to work with local/remote database, and to display the schema in DB manager too if I wanted. It doesn’t seem quite as easy any more - but I’m sure it’s more flexible now.

It’s interesting to hear about these advantages and I’m sure there are many more. I suppose it’s having little idea of how these things work which would worry me. With Apache/PHP/MySQL etc, I can pretty much always get to the bottom of a problem, whereas NodeJS seems more like a black box, potentially attached to lots of other black boxes. Very powerful, but very alarming. Also, there are certain things I do with PHP and htaccess for example, which I haven’t a clue how to do with NodeJS, but I’m sure there are ways.

1 Like

It definitely is more flexible and powerful. The issues have started popping up lately due to the new GLOBAL stuff.

I read that this is supposed to be backwards compatible, but so far, it looks like an alpha version. As per the posts around community, this has improved over the updates, but I am very afraid to turn on experimental and test myself. Had it on accidentally once and had to re-create a NodeJS project completely. I also saw some changes to the security provider identity value, which does not look like its backwards compatible. Not sure though.

I do hope this is not released any time soon until the bugs are ironed out.

Haven’t seen the schema update in Wappler automatically. And I don’t rely on the refresh in builder. I prefer to just go to DB connect directly and hit save to update the schema.
What I learned while testing NodeJS with Wappler is that both these options are not possible and only way is to go into DB manager.

With the GLOBALS stuff, I think things are becoming more streamlined and would function universally for all server modals.

It certainly doesn’t seem posssible to develop APIs etc. with the experimental features turned on, and then for those APIs to work if you switch those features turned off. In fact, it seems even trying out the experimental features means you can’t go continue without them - I just tried and my APIs no longer work (connection errors).

What I’m not sure about is what features might not work if you were to switch to using the experimental features only - eg on a new project. I am aware of the Validator issue - but I think that only applies to the existing record check, where a database connection is required. I don’t know if there are other issues/bugs, at least if you’re using PHP. The globals are such an improvement, it’s tempting to use them now.

I may not be talking about quite the same thing. I make changes externally, using Navicat, and they always seem to appear automatically in Wappler.

Tom - there is one very important step, when working with with database on remote targets: