title: How To save DataFrame Into Cassandra table using Spark Java API
body: <p>I want to save data frame into cassandra table using sparkJava API</p>
  
  <p>I want to add the part of saving in the following code 
  I want to save people dataframe into cassandra table and make queries on that cassandra table</p>
  
  <pre><code>import org.apache.spark.api.java.*;
  import org.apache.spark.SparkConf;
  import org.apache.spark.api.java.function.Function;
  import org.apache.spark.sql.types.DataTypes;
  import org.apache.spark.sql.types.StructType;
  import org.apache.spark.sql.types.StructField;
  import org.apache.spark.sql.Row;
  import org.apache.spark.sql.RowFactory;
  import org.apache.spark.sql.SQLContext;
  import com.datastax.spark.connector.cql.CassandraConnector;
  import com.datastax.spark.connector.japi.CassandraRow;
  import org.apache.spark.sql.SQLContext;
  import org.apache.spark.api.java.JavaRDD;
  import org.apache.spark.api.java.JavaSparkContext;
  import org.apache.spark.sql.DataFrame;
  
  public class SimpleApp {
    public static void main(String[] args) {
      SparkConf conf = new SparkConf().setAppName("Simple Application");
      conf.setMaster("local");
      conf.set("spark.cassandra.connection.host", "localhost");
      JavaSparkContext sc = new JavaSparkContext(conf);
      SQLContext sqlContext = new org.apache.spark.sql.SQLContext(sc);
      DataFrame people = sqlContext.read().json("/root/people.json");
      people.printSchema();
      people.registerTempTable("people");
      **//I want to save this TempTable or people dataframe into cassandra table and make teenagers SQL query on that cassandra table** 
      DataFrame teenagers = sqlContext.sql("SELECT name FROM people WHERE age &gt;= 13 AND age &lt;= 19");
      teenagers.show();
  
  
   }
  }
  </code></pre>