Joshua Baylin
Joshua Baylin

Reputation: 19

Google Apps Scripts/JDBC/MySQL

I am trying to connect Google Apps Scripts to a MySQL server hosted on Rackspace. I'm using the documentation provided here.

https://developers.google.com/apps-script/jdbc

I set the parameters correctly in this line of code:

var conn = Jdbc.getConnection("jdbc:mysql://127.0.0.1:3306/dbname","user","pw");

I receive this error.

Failed to establish a database connection. Check connection string, username and password. (line 2)

I use Putty to Tunnel to the Database and Port Forward on my local machine and have no issues connecting to other programs that use the Database (Tableau, MySQL etc.).

I am stumped. Tried multiple user/pw iterations, allowed Google's ports to access the database etc.

Thank you in advance.

Upvotes: 1

Views: 6180

Answers (1)

RachelW
RachelW

Reputation: 95

I had many issues with connecting at first, took 3 of us to get it exactly right. In the end I found a webpage, sorry I don't remember which one, that provided me with this:

var conn = Jdbc.getConnection("jdbc:sqlserver://localhost:1433;" +
   "databaseName=AdventureWorks;user=MyUserName;password=*****;");

I entered my info, made sure I was using port 1433 and the connection was made. Hope this helps!

Upvotes: 3

Related Questions