title: Are single quotations necessary in SQL queries? Specifically, Java JDBC queries
body: <p>I am using MySQL Workbench as a GUI for my servers.</p>
  
  <p>Looking at some of the queries that Workbench does, it seems to single quotation my database name and the column names, i.e. </p>
  
  <pre><code>"INSERT INTO `mydb`.`weather_data`(`dateTime`,`hourlyTemp`,`dewPoint`,`windSpeed`,`relHum`) VALUES(?,?,?,?,?)";
  </code></pre>
  
  <p>Now, I am using JDBC (Java) to do an automatic query. The string I use is: </p>
  
  <pre><code>String insertTableSQL = "INSERT INTO `mydb`.`weather_data`" 
                  + "(`dateTime`,`hourlyTemp`,`dewPoint`,`windSpeed`,`relHum`) VALUES" 
                  + "(?,?,?,?,?)";
  </code></pre>
  
  <p>My question is, should I use the single quotations? Should I remove them? Is it necessary?</p>
  
  <p>EDIT second question:</p>
  
  <p>This is my full preparedStatement();</p>
  
  <pre><code>private static void batchInsertRecordsIntoTable() throws SQLException{
          Connection dbConnection = null;
          PreparedStatement preparedStatement = null;
  
          String insertTableSQL = "INSERT INTO `mydb`.`weather_data`" 
                  + "(`dateTime`,`hourlyTemp`,`dewPoint`,`windSpeed`,`relHum`) VALUES" 
                  + "(?,?,?,?,?)";
          try{
              dbConnection = getDBConnection();
              preparedStatement = dbConnection.prepareStatement(insertTableSQL);
  
              dbConnection.setAutoCommit(false);
  
              preparedStatement.setString(1, "1111111111"); // dateTime
              preparedStatement.setInt(2, 12); // hourlyTemp
              preparedStatement.setInt(3, 12); // dewPoint
              preparedStatement.setInt(4, 12); //windSpped
              preparedStatement.setInt(5, 12); //relHum
              preparedStatement.addBatch();
  
              preparedStatement.executeBatch();
  
              dbConnection.commit();
  
              System.out.println("Record was inserted into mydb weather_data");
  
          }catch(SQLException e){
              System.out.println(e.getMessage());
              dbConnection.rollback();
          }finally{
              if(preparedStatement!=null){
                  preparedStatement.close();
              }
              if(dbConnection!=null){
                  dbConnection.close();
              }
          }
      }
  </code></pre>
  
  <p>For some reason, the data is not being appended/added/inserted into my DB despite having no connection errors.</p>