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
postgres://user:password@server_address:port/database_name. For MySQL replace âpostgresâ with âmysqlâ
Concrete example:
postgres://ricardo:secret_password@128.203.134.78:5432/employees
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:
mysql://knockknock:whosthere@162.243.34.135:3306/employees
The database loaded on it:
https://dev.mysql.com/doc/employee/en/sakila-structure.html
(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?
Thanks,
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
aa107oshby1g79j.cf234yrgtj6cf.us-east-1.rds.amazonaws.com
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.
Any suggestions?
Thanks,
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.
Thanks,
Levon.
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.