import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Properties; public class App { public static void main(String[] args) throws Exception { String url = "jdbc:postgresql://localhost/zoldzrt"; Properties props = new Properties(); props.setProperty("user", "zoldzrt"); props.setProperty("password", "titok"); props.setProperty("ssl", "ture"); try { Connection conn = DriverManager.getConnection(url, props); System.out.println("Ok. A kapcsolódás sikeres."); String sql = "delete from employees " + "where id=?"; PreparedStatement ps = conn.prepareStatement(sql); ps.setInt(1, 2); int affectedRows = ps.executeUpdate(); System.out.println("Érintett sorok: " + affectedRows); } catch (SQLException e) { System.err.println("Hiba!"); System.err.println(e.getMessage()); } } }