title: save google forms response to a mysql database
body: <p>I have this html file for the google form and would like to store form response in a mysql database. As of now I am storing my form response to a google sheet and copying this data to a mysql table. Now I want my results stored directly stored in the database.</p>
  
  <pre><code>//index.html
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;b&gt;Add Record&lt;/b&gt;&lt;br /&gt;
  
      &lt;form&gt;
      First name: &lt;input id="firstname" name="firstName" type="text" /&gt; &lt;br /&gt;
  
      Last name: &lt;input id="lastname" name="lastName" type="text" /&gt; &lt;br /&gt;
  
      DOB: &lt;input id="dob" name="dob" type="date" /&gt; &lt;br /&gt;
  
      Email: &lt;input id="email" name="email type="text" /&gt; &lt;br /&gt;
  
      Phone: &lt;input id="phone" name="phone" type="text" /&gt; &lt;br /&gt;
  
     &lt;input onclick="formSubmit()" type="button" value="Add Row" /&gt; &lt;br /&gt;
  
     &lt;input onclick="google.script.host.close()" type="button" value="Exit" /&gt;
     &lt;/form&gt;
    &lt;script type="text/javascript"&gt;
          function formSubmit() {
              google.script.run.getValuesFromForm(document.forms[0]);
          }
      &lt;/script&gt;
  &lt;/html&gt;
  
  
      function getData(){
     var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
   var formResponses = form.getResponses();
   for (var i = 0; i &lt; formResponses.length; i++) {
     var formResponse = formResponses[i];
     var itemResponses = formResponse.getItemResponses();
     for (var j = 0; j &lt; itemResponses.length; j++) {
       var itemResponse = itemResponses[j];
        var firstName = itemResponse.getResponse(),
        lastName = itemResponse.getResponse(),
        dob = itemResponse.getResponse(),
        email = itemResponse.getResponse(),
        phone = itemResponse.getResponse(),
        insertFormData = copyDataToTable(firstName, lastName, dob, email, phone);
  }
  
  
   function copyDataToTable(firstName, lastName, dob, email, phone) 
   {
    var conn = Jdbc.getConnection(dbUrl, user, userPwd);
  
    var stmt = conn.prepareStatement('INSERT INTO myTable (firstName, lastName, dob, email, phone) values (?, ?, ?, ?, ?)');
    stmt.setString(1, firstName);
    stmt.setString(2, lastName);
    stmt.setString(3, dob);
    stmt.setString(4, email);
    stmt.setString(5, phone);
    stmt.execute();
  }
  </code></pre>