title: Insert a Date into oracle database
body: <p>I need to insert date into my database, i have a table that contains a row date of type Date but i need to insert the date without using preparedStatement but it wont work. here is my code:</p>
  
  <pre><code>try{
  
          dbConnection = DriverManager.getConnection(DR_URL, DB_USER,DB_PASSWORD);
          stmt = dbConnection.createStatement();
  
          for(int i=1; i&lt;3; i++){
                          String invoiceNumber = JOptionPane.showInputDialog("Invoice Number:");
                          String customerName = JOptionPane.showInputDialog("Customer Name:");
                          Date invoiceDate = new Date(System.currentTimeMillis());
                          java.sql.Date invDate = new java.sql.Date (invoiceDate.getTime());
  
                          stmt.executeUpdate("INSERT INTO INVOICEMAIN VALUES ('" + invoiceNumber + "','" + customerName + "','" + setDate(invDate) + "')");
                      }
  
          stmt.close();
          dbConnection.close();
      }
  </code></pre>