- Creating connection
c = DriverManager.getConnection ("jdbc:postgresql://localhost:5432/postgres", "postgres",
"postgre_manas9");
- Statement :
- executes static sql queries
- need to use CreateStatement() on an active connection
object
st = con.createStatement();
- st.execute(): : use when you are not sure that query would
return data or manipulate data
- executeQuery(): returns a ResultSet
- executeUpdate() : used in transaction, delete and update
operations
- Prepared Statement : execute precompiled queries to improve
performance. PreparedStatement object accepts parameters at runtime.
|