Hi guys,
So I have a macro that pulls data from a mySQL table from a database on localhost server.
I have another mySQL server which has been successfully connected to a cloud SQL instance in the Google Developers Console.
I would like to take the existing macro I have and rather than pull data from the localhost table, I would like it to pull from the Google server.
The macro code is as follows:
It is not as simple as changing Server_Name = to GoogleServer (as I've named it in mySQL) or the direct IP address
If I do, I get an error on the cn.Open line saying cannot find server.
For the localhost configuration, I had to check off [Microsoft Active X Data Objects 2.x library] in VBA Reference.
If there a specific one I need to check off to connect to the Google server? ...something about JDBC?
Any help would be appreciated!
So I have a macro that pulls data from a mySQL table from a database on localhost server.
I have another mySQL server which has been successfully connected to a cloud SQL instance in the Google Developers Console.
I would like to take the existing macro I have and rather than pull data from the localhost table, I would like it to pull from the Google server.
The macro code is as follows:
Code:
Public cn As ADODB.Connection
Sub ADOExcelSQLServer()
Dim Server_Name As String
Dim Database_Name As String
Dim User_ID As String
Dim Password As String
Dim SQLStr As String
Server_Name = "localhost" ' Enter your server name here
Database_Name = "materialsDB" ' Enter your database name here
User_ID = "rickastley" ' enter your user ID here
Password = "nevergunnagiveyouup" ' Enter your password here
SQLStr = "SELECT * FROM materials" ' Enter your SQL here
Set cn = New ADODB.Connection
cn.Open "Driver={MySQL ODBC 5.3 Unicode Driver};Server=" & Server_Name & ";Database=" & Database_Name & _
";Uid=" & User_ID & ";Pwd=" & Password & ";"
End Sub
It is not as simple as changing Server_Name = to GoogleServer (as I've named it in mySQL) or the direct IP address
If I do, I get an error on the cn.Open line saying cannot find server.
For the localhost configuration, I had to check off [Microsoft Active X Data Objects 2.x library] in VBA Reference.
If there a specific one I need to check off to connect to the Google server? ...something about JDBC?
Any help would be appreciated!
