We just deployed a plugin that allows you to read/write data from databases (currently PostgreSQL and MySQL). See more info at https://bubble.io/reference#Plugins.dbconnector
How do you reference the connector within bubble?
You can publish it as a datasource, action or both.
To use it as an action, look under plugins when creating a new action.
To use it as a datasource, use the Get data from external API option and look for your query’s name in the list of options for it. Makes sense?
Can you provide an example connection string? There are many variations (C.f., https://www.connectionstrings.com/) and none seem to work for a normal 3306 external mySQL 4.1 or 5.6 or 5.7 database. Thanks.
Thanks for asking - I updated the documentation (deploying soon) but here it is
Now, your server port / configuration might differ. Here are the steps I took to test, generally going up the OSI stack (see https://support.rackspace.com/how-to/mysql-connect-to-your-database-remotely/)
- Can I ping the remote server? (sometimes pings are disabled, check with your administrator)
- Can I telnet to the machine?
- Does the user have rights to connect remotely?
- Do I have the right password?
Lots of really good tutorials on how to test out there.
I set up a mysql server for y’all so you can test.
Here are the deets:
The database loaded on it:
(Please be kind to the DB, you have full rights to it. If someone renders it unusable, I have an image I can restore from so just ask )
Here’s a sample MySQL parameterized query and one way to map returned columns:
And a PostgreSQL query with parameters:
And a full example in the forum app:
@georgeciobanu We want to use a database connector for a client - but his host requires adding the source IPs to a whitelist in order to allow access. What are the IP adresses (or a range of IPs) that Bubble use to access the data through the database connector?
We unfortunately can’t guarantee IP addresses right now, but we’ll be able to do this soon for users on the enterprise plan. One way is to allow connection from any IP and use a special, limited-access (read-only) user from the DB Connector.
How about a range of IPs? For example 212.167.23.x or 212.167.x.x ?
@georgeciobanu is it possible to use server’s alias instead of an IP address in the connection string? for example like this
I don’t think we can guarantee the ip range at this stage (except for the enterprise plan).
Ok and is it possible to use server’s alias instead of an IP address in the connection string? for example like thisaa107oshby1g79j.cf234yrgtj6cf.us-east-1.rds.amazonaws.com
@emmanuel @georgeciobanu - guys can you please answer this question? it’s for the client
is it possible to use server’s alias instead of an IP address in the connection string? for example like thisaa107oshby1g79j.cf234yrgtj6cf.us-east-1.rds.amazonaws.com
Yes, you can, but we can’t guarantee that won’t change either.
Wcan discuss setting up a fixed IP for someone with dedicated hosting (enterprise plan).
I have a small issue. I connected to a MySQL database on AWS.
So I want to use a field called Reg No as a parameter. When I define the query string as:
select * from All_PL where Reg No=? limit 200 - it gives an error
when trying this
select * from All_PL where Reg_No=? limit 200 - it doesn’t find the field
when trying this
select * from All_PL where “Reg_No”=? limit 200 no error but in the run mode it doesn’t return any results when using this query.
When using a parameter with a field that doesn’t have spaces (for example “model”) everything works fine.
In the forum app shared by George, he uses “where emp_no=?” and in the parameter details it appears “emp no” and seems to work.
But in my case there is an issue with using a field that has a space.
Have you find the issue?
Did you try “Reg No” in quotes?
You also might try Reg%20No with no quotes.
FWIW, it’s best to NOT embed spaces in anything. Use underscores instead.
Thanks, WIz, we solved it simply be removing the spaces in the field names. I think we tried using quotes and %20, as far as I remember it didn’t help.
Founder at Bubblewits - Bubble Certified Partner
http://iambubble.com - one page Bubble demo
http://builtonbubble.com - Collection of apps built on Bubble
Dev.zeroqode.com - Reach out if you need help creating something on Bubble
Let us know if the dot (and other special characters) is a recurring issue. if so we can try to do something about it.
the problem was with the spaces. We have removed the spaces in the field names in our SQL database, but i guess that it may not be always possible, if the Bubble user doesn’t own the database. So if you could fix the spacing issue in the connector that might be helpful for future cases.
Hello @georgeciobanu ,
Could you make an example of how to export the data to Mysql database?
I´ve been reading the forum but yet I can´t figure out how it´s possible.
Thanks a lot.