title: Read from a file and insert the text into a table
body: <p>I am reading from a text file, then using that text to update a table. The code that I am having trouble with is the <code>String insertStatement</code>. I marked the problem location with a comment. Sorry it is a bit of a mess, but I wanted to include all that I have so far.</p>
  
  <p>The file reads in fine and outputs fine I just need to figure out a way to insert the file information stored in the variable <code>line</code> into my table named <code>EMPLOYEE_COPY</code>.</p>
  
  <pre><code>import java.sql.*;
  import java.io.*;
  
  public class lab13 {
      {
  
      }
  
      public static void main(String [] args) throws SQLException {
          // The name of the file to open.
          Connection conn = DriverManager.getConnection(
                  "jdbc:oracle:thin:@classdb.jccc.edu:1521:cisdb", "jpierc37", "jp2687");
          System.out.println("connected");
              String fileName = "enrollment.txt";
              Statement statement = conn.createStatement();
  
              // This will reference one line at a time
              String line = null;
              try
              {        
                  // FileReader reads text files in the default encoding.
                  FileReader fileReader = 
                      new FileReader(fileName);
  
                  // Always wrap FileReader in BufferedReader.
                  BufferedReader bufferedReader = 
                      new BufferedReader(fileReader);
                  Statement insert = conn.createStatement();                 
  
                  while((line = bufferedReader.readLine()) != null) {
                      System.out.println(line);
                      String insertStatement =
                              // This is the problem here.**********************************************
                              "INSERT INTO EMPLOYEE_COPY(Employee_ID, Name, Salary, Title)" +
                                      "VALUES(line)";
                      int count2 = insert.executeUpdate(insertStatement);
                      System.out.println("Inserted: " + count2);
                  }   
  
                  // Always close files.
                  bufferedReader.close();       
              }
              catch(FileNotFoundException ex) {
                  System.out.println(
                      "Unable to open file '");                
              }
              catch(IOException ex) {
                  System.out.println(
                      "Error reading file '");                  
                  // Or we could just do this: 
                  // ex.printStackTrace();
              } catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
          }       
      }
  </code></pre>