title: google apps script jbdc sql server database connection string error
body: <p>I'm trying to connect to my local sql server database at my home network using the code that I found from this site <a href="https://stackoverflow.com/questions/15440939/querying-sql-server-with-google-apps-script-via-jdbc">Querying SQL Server with Google Apps Script via JDBC</a> about 3 years ago which was marked being correct. However, I get the error message <strong>"We're sorry, a server error occurred. Please wait a bit and try again."</strong>. This error is from line 2 where the connection string is defined. I retried several times, but I always get the same error. When I searched this error, it seems like it could be too many things and I was not able to find any answers for my issue. Thanks.</p>
  
  <p>This was the code that was marked being correct:</p>
  
  <pre><code>function readAzure() {
       var conn = Jdbc.getConnection("jdbc:sqlserver://XYZ.database.windows.net:1433;databaseName=MYDATABSENAME","USERNAME","PASSWORD");
       var stmt = conn.createStatement();
       var rs = stmt.executeQuery("select * from helloworld");
  
       var doc = SpreadsheetApp.create('azure');
       var cell = doc.getRange('a1');
       var row = 0;
       while(rs.next()) {
       cell.offset(row, 0).setValue(rs.getString(1));
       cell.offset(row, 1).setValue(rs.getString(2));
       row++;
       }
  
  
     rs.close();
     stmt.close();
         conn.close();
  
  }
  </code></pre>
  
  <p>I also found another connection string code and when I try this format I get the same error.</p>
  
  <pre><code>var conn = Jdbc.getConnection("jdbc:sqlserver://IP-address:1433;" + "databaseName=DBName;user=username;password=password;");
  </code></pre>