mysql plugin

How do I install the mysql plugin?

My setup is via tunneling the cloud database so I can test locally as if it were a localhost, as recommended in the documentation.
What I have done so far is to configure the ssh tunnel, connect to the Xojo cloud mysql with Sequel pro (and mysql manager too), created a database and inserted data with Sequel pro.

In the web app (xojo project) I inserted a mysql database component, which accepts the credentials and supposedly connects to the database.
The on the main form, added an event Shown, where it connects to the database (debugged it step by step), but when doing a query it returns nil, like so:

// Initialization seem to connect ok to the server and to the database

DataList.DeleteAllRows

Dim sql As String
sql = “SELECT * FROM customer_main”

Dim data As RecordSet
data = db.SQLSelect(sql) // HERE IT RETURNS NIL. IT SHOULD RETURN A DATASET

It is failing to retrieve the records. According to documentation, I should work the same when local testing as if deployed to xojocloud.
That is why I thought maybe I still need the plugin. In the documentation it says I should copy a mysql plugin. I assumed it was done just by inserting a mysql community database in the project.

Please, I need some guidance here.

JD

You should have the file “MySQLCommunityPlugin.xojo_plugin” in the Xojo Pluginfolder. Xojo loads the plugins from this folder when you launch the IDE. Make sure you really quit the IDE before putting new plugins here.

or a third party mysql plugin if you like to use that one.

Thanks Joost, it is there. Today will make test with a Mamp localhost (really local, not tunneled) in order to isolate the problem.

Solved… no wonder is a Getting Started post.

The problem was the scope of the variable assigned to the database reference.
In the open event of the webpage, I coded this:

Dim db as New MySQLCommunityServer
Reading further in the documentation, a variable created with Dim has a local scope.

Instead,
db = New MySQLCommunityServer
Keeps the variable alive across all the webpage scripts.

@Julio Debroy - I guess it will never happen to you again. :slight_smile: