Though , PreparedStatement can do everything i.e DDL ,DML related queries with better performance than Statement.Than , why still Statement interface exist in Java API?
Though , PreparedStatement can do everything i.e DDL ,DML related queries with better performance
Share
Because some queries don’t have any parameter, and preparing the statement and then executing it can actually be less efficient than executing the statement directly. It’s also more readable and straightforward in this case to use (and potentially reuse) a single statement.
Here’s what the javadoc says, BTW: