@@ -0,0 +1,2664 @@
+/*Programmer: Kristoffer Larson%0A *Date: April 26, 2014%0A *%0A *Description: Connect to a DB and update a table.%0A *%0A */%0A%0Aimport java.sql.*;%0A%0Apublic class DBUpdateTable%0A%7B%0A   Connection c = null;%0A   Statement stmt = null;%0A   %0A   public DBUpdateTable()%0A   %7B%0A      modify();%0A      select();%0A   %7D%0A   %0A   public void modify()%0A   %7B%0A      try %7B%0A         Class.forName(%22org.sqlite.JDBC%22);%0A         c = DriverManager.getConnection(%22jdbc:sqlite:test.db%22);%0A         c.setAutoCommit(false);%0A         System.out.println(%22Opened database successfully%22);%0A      %0A         stmt = c.createStatement();%0A         String sql = %22UPDATE COMPANY set SALARY = 20000.00 where ID=1;%22;%0A         stmt.executeUpdate(sql);%0A         c.commit();%0A         sql = %22UPDATE COMPANY set NAME = 'Jim' where ID=2;%22;%0A         stmt.executeUpdate(sql);%0A         c.commit();%0A         sql = %22UPDATE COMPANY set AGE = 10 where ID=3;%22;%0A         stmt.executeUpdate(sql);%0A         c.commit();%0A         %0A         sql = %22UPDATE COMPANY set ADDRESS = 'Washington BLVD' where ID=4;%22;%0A         stmt.executeUpdate(sql);%0A         c.commit();%0A         %0A         stmt.close();%0A         c.close();%0A      %7D %0A      catch ( Exception e ) %7B%0A         System.err.println( e.getClass().getName() + %22: %22 + e.getMessage() );%0A         System.exit(0);%0A      %7D%0A      System.out.println(%22Operation done successfully%22);%0A   %7D%0A   %0A   public void select()%0A   %7B%0A      try %7B%0A         Class.forName(%22org.sqlite.JDBC%22);%0A         c = DriverManager.getConnection(%22jdbc:sqlite:test.db%22);%0A         c.setAutoCommit(false);%0A         System.out.println(%22Opened database successfully%22);%0A      %0A         stmt = c.createStatement();%0A         ResultSet rs = stmt.executeQuery( %22SELECT * FROM COMPANY;%22 );%0A         while ( rs.next() ) %7B%0A            int id = rs.getInt(%22id%22);%0A            String  name = rs.getString(%22name%22);%0A            int age  = rs.getInt(%22age%22);%0A            String  address = rs.getString(%22address%22);%0A            float salary = rs.getFloat(%22salary%22);%0A            System.out.println( %22ID = %22 + id );%0A            System.out.println( %22NAME = %22 + name );%0A            System.out.println( %22AGE = %22 + age );%0A            System.out.println( %22ADDRESS = %22 + address );%0A            System.out.println( %22SALARY = %22 + salary );%0A            System.out.println();%0A         %7D%0A         rs.close();%0A         stmt.close();%0A         c.close();%0A      %7D %0A      catch ( Exception e ) %7B%0A         System.err.println( e.getClass().getName() + %22: %22 + e.getMessage() );%0A         System.exit(0);%0A      %7D%0A      System.out.println(%22Operation done successfully%22);%0A   %7D%0A   %0A   public static void main(String%5B%5D args)%0A   %7B%0A      DBUpdateTable app = new DBUpdateTable();%0A   %7D%0A%0A%7D%0A

Create DBUpdateTable.java