What is the difference between these two statements, do they both work the same way, or does the first one work at all? Can I use variables after "Insert into"?
stmt = conn.prepareStatement("INSERT INTO treatment(CPR,Treatment,ID,TreatedOn) "+
"VALUES("+Cpr+Id+date.toString());
Where id, cpr are a string,int or other variable, bin my case it is a string,
PreparedStatement insertStatement;
        insertStatement = connection.prepareStatement("INSERT INTO sep2.movies(title,length) "
                + "VALUES (?,?,?)");
        insertStatement.setString(1, Title);
        insertStatement.setInt(2, movie.getLength());
where Title is a string and getLength returns an int.
Which one of these should I use ?
I understand what setString does but do I have to use it?
Also I am inserting only elementary/non-object data types into Treatment. Does it make a difference? (I am using postgres if that matters)
 
     
    