Apologies if this sounds trivial but I’m attempting to connect to Google Cloud SQL using XOJO code provided in one of the examples that come with XOJO i.e. MySQLExample as shown below:
mDb = New MySQLCommunityServer
mDb.Host = "xxx.xxx.xx.xx:3306"
mDb.UserName = "root"
mDb.Password = "xxxxxxxxxxxx"
mDb.DatabaseName = "guestbook"
If mDb.Connect Then
mIsConnected = True
ConnectStatusLabel.Text = "Connected to MySQL"
Else
mIsConnected = False
ConnectStatusLabel.Text = "Error connecting to MySQL: " + mDb.ErrorMessage
End If
Is it actually listening on a public port ?
Or is it maybe set up to listen only to things on Google cloud like the compute engine etc ?
That would be my first guess.
@Norman Palardy :
With regard to the port AFAIK and I’ve checked it is listening on a public port. Using the “Connect to database” option in the MySQL workbench client I’m able to connect to the database instance using the parameters I’m attempting programatically. And as for only reading another Google service I dont think its doing so as the host address is specifically for the Cloud SQL instance.
@Christian Schmitz :
No errors have been thrown when I use the MySQL workbench client/program.
@Rick Araujo :
Thanks for the links. Went through the steps in them just to confirm i was doing things correctly. The IP address I’m attempting to connect from is in the list of authorised networks. Through the MySQL workbench I also created another user and attempted to connect using this user but to no success.
@Oliver Osswald : mDb.ErrorMessage returns Unknown MySQL server host “xxx.xxx.xx.xx:3306”. How could this be when I can access the same database using MySQL workbench.
@ Rick A : I’ve granted all user as follows:
grant all privileges on mydb.guestbook to testuser@’%’ identified by ‘*************’;
Hey guys,
I too am facing the similar issue as above. @Alex Monari were you able to solve the issue and connect to the Cloud SQL.
Me too am pretty confident that the Cloud SQL has been configured quite correctly.
Infact prior to Xojo, I was using Processing 3, and it has worked great.