title: DB2 SQL Error: SQLCODE=-117, SQLSTATE=42802, SQLERRMC=null, DRIVER=3.68.61
body: <p>I'm experiencing this problem while developing in Java and inserting records into a DB2 database. </p>
  
  <pre><code>sqlInsert = "INSERT into SI_Orders (SellersNo,OrderDate,ShipDatePlanned,"
              + "Warehouse,OrderType,ShipToName,ShipToAddress1,"
              + "ShipToCity,ShipToProvState,ShipToPostalZip,ShipToCountry" + ") "
              + "VALUES (?, ?, ?,'01','DO','bob','a','toronto','ON','h0h0h0','CA')";
  
      try {
          con = dc.getConnection();
          con.setAutoCommit(false);
          db2Stmt = con.prepareStatement(sqlInsert);
  
          for (Order order : orderWrapper.orders) {
              save1 = con.setSavepoint();
              db2Stmt.setString(1, order.getOrderId());
              db2Stmt.setTimestamp(2, shipStnDateFormat( order.getOrderDate() ) );            
              db2Stmt.setString(3, null); // PONo
               /*
               * db2Stmt.setTimestamp(4, shipStnDateFormat(order.getShipByDate()));
               */
              db2Stmt.executeUpdate();    
              //con.commit();
          } // end of enhanced for each block
      } // end of try block
  
      catch (SQLException e1) {
          e1.printStackTrace();
          if (con != null) {
              try {
                  System.err.print("Transaction is being rolled back.");
                  con.rollback();
              } 
  
              catch (SQLException se) {
                  se.printStackTrace();
              } 
          } // end of if(con != null) block
      } // end of catch block
      finally {
          // Clean-up code
          con.setAutoCommit(true);
  
          if (db2Stmt != null) {
              db2Stmt.close();
          }
  
          if (con !=null){
              con.close();
          }
      } // end of finally block
  } // end of insertDB method
  
  private Timestamp shipStnDateFormat(String shipByDate) {
      SimpleDateFormat shipStnDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
      SimpleDateFormat standardDateFormat = new SimpleDateFormat("yyyy-MM-dd");
      String parsedFinalFormattedDate = null;
      Date finalDate = null;
  
      if (shipByDate == null)
          return new java.sql.Timestamp(0); // return a dummy value
  
      else {
          try {
              Date parsedShipByDate = shipStnDateFormat.parse(shipByDate); //
              parsedFinalFormattedDate = standardDateFormat.format(parsedShipByDate); //
              finalDate = standardDateFormat.parse(parsedFinalFormattedDate); //
          } catch (ParseException e) {
              e.printStackTrace();
          }
  
          return new java.sql.Timestamp(finalDate.getTime());
      } // end of else statement
  } // end of shipStnDateFormat method`
  </code></pre>
  
  <p>I get this error...
  DB2 SQL Error: SQLCODE=-117, SQLSTATE=42802, SQLERRMC=null, DRIVER=3.6in8.61</p>
  
  <p>Obviously, I'd like it to insert all three columns without throwing a SQL Exception.</p>
  
  <p>Also, here's the DDL I used to create the table which shows the datatypes of each column and whether a NOT NULL constraint is enforced or not. </p>
  
  <p>The first column "OrderId" is an identity column, so I haven't issued an insert parameter for that. </p>
  
  <pre><code>CREATE TABLE SI_Orders (
  OrderId INTEGER NOT NULL generated always as identity (start with 0, 
  increment by 1, no cache),
  SellersNo VARCHAR(20) NOT NULL,
  OrderDate Timestamp(0) NOT NULL,
  PONo VARCHAR(20),
  ShipDatePlanned Timestamp(0) NOT NULL,
  CONSTRAINT PK_SI_Orders PRIMARY KEY (OrderId)
  );
  </code></pre>