	   import java.io.*;
	   import java.util.*;
	   import javax.swing.*;
       import javax.swing.table.*;
       import java.awt.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
		        
public class H9Ex3
{	
public static void main(String args[]) throws IOException,ClassNotFoundException
{	

    // load the sqlite-JDBC driver using the current class loader
    Class.forName("org.sqlite.JDBC");   
    Connection connection = null;
    try
    {
      // create a database connection
      connection = DriverManager.getConnection("jdbc:sqlite:H9.db");
      Statement statement = connection.createStatement();
      statement.setQueryTimeout(30);  // set timeout to 30 sec.      
      statement.executeUpdate("drop table if exists H9Ex3");
      statement.executeUpdate("create table H9Ex3(x double, sinx double)");
      String s2="";
      for(double x=0.0;x<=Math.PI+0.01;x+=0.01)
      {
      s2=""+x+","+Math.sin(x);
      statement.executeUpdate("insert into H9Ex3 values("+s2+");");
      }    
      ResultSet rs = statement.executeQuery("select * from H9Ex3");
      while(rs.next())
      {
        // read the result set
        double x=rs.getDouble("x");
        double s=rs.getDouble("sinx");
        System.out.println(" x = " + x+" y=sin(x) = "+s);
      }
    }
    catch(SQLException e)
    {
      // if the error message is "out of memory", 
      // it probably means no database file is found
      System.err.println(e.getMessage());
    }
    finally
    {
      try
      {
        if(connection != null)
          connection.close();
      }
      catch(SQLException e)
      {
        // connection close failed.
        System.err.println(e);
      }
    }
}
}
