why a valid date insertion throws java.sql.SQLDataException: ORA-01843: not a valid month oracle java

i am trying to insert date value into the oracle database but its throw java.sql.SQLDataException: ORA-01843: not a valid month the weirdest thing that happened, when i open oracle dashboard and i execute the same query into sql commands its work perfectly but when try to execute the query from java it launch the exception

this is my code

try {
        
            Connection con=Connexion.getConnection();
            Statement stmt=con.createStatement();
            Format formatter = new SimpleDateFormat("MM/dd/YYYY");
            String ddebut=formatter.format(dateDebut);
            String dfin=formatter.format(dateFin);

            System.out.println(ddebut);
            System.out.println(dfin);
            String query ="INSERT INTO Intervention (titre,lieu,etat,description,datedebut,datefin,ide) VALUES ('"+titre+"','"+lieu+"','"+etat+"','"
                    +description+"','"+ddebut+"','"+dfin+"',"+cin+")";
            System.out.println(query);

            test=stmt.executeUpdate(query);
            System.out.println(formatter.format(dateDebut));
            ResultSet rs=stmt.executeQuery("select intervention_seq.currval from DUAL");
            rs.next();
            id=rs.getInt(1);
        
        
            con.close();  
        
    

        }catch(Exception e){ System.out.println(e);}
        return test==1;
    }

im sure that the problem come from the query and all values of attribute are correct

is there a way to solve this problem ?enter image description here



from Recent Questions - Stack Overflow https://ift.tt/3ea3dKH
https://ift.tt/2RjUDjn

Comments

Popular posts from this blog

Hibernate Search - Elasticsearch with JSON manipulation

Today Walkin 14th-Sept

Spring Elasticsearch Operations