Reputation: 305
I have a question here. I want to set up a Google sheet and populate this sheet with numbers from my local database. And my network is VPN network. I program in Google spreadsheet script editor. Using the following code to connect my local database:
var address = '10.0.0.71:1433/DatabaseName';
var username = 'DOMAIN\username';
var password = 'root';
var dbUrl = 'jdbc:sqlserver://' + address;
function createDatabase() {
var conn = Jdbc.getConnection(dbUrl, username, password);
var stmt = conn.createStatement();
var rs = stmt.execute('SELECT * FROM ITEM');
stmt.close();
conn.close();
}
However, this connection test doesn't work at all.
The error is:
Failed to establish a database connection. Check connection string, username and password.
Upvotes: 0
Views: 1512
Reputation: 11
From my understanding of Google Apps Scripts, your database need to be reachable from the Internet (that's how Google works, in the Cloud).
Upvotes: 1