Lesson: JDBC
1. Add dependency: implementation group : 'org.postgresql' , name : 'postgresql' , version : '42.6.0' 2. Load Postgres driver: Class . forName ( "org.postgresql.Driver" ) ; 3. Create Connection: Connection con = DriverManager . getConnection ( "jdbc:postgresql://localhost:5432/se_21" , "postgres" , "112358" ) ; 4. Create Statement: Statement stmt = con .createStatement() ; 5. Create ResultSet: ResultSet rs = stmt .executeQuery( " select * from student " ) ; 6. Iterate ResultSet: while (rs.next()) { System. out .println(rs.getString( "name" )) ; } 7. Insert into DB with JDBC String query = " insert into person(name, surname, age, pin, password) values (?, ?, ?, ?, ?) " ; PreparedStatement stmt = con.prepareStatement(query) ; stmt.setString( 1 , person.getName()) ; stmt.setString( 2 , person.getSurname()) ; stmt.setInt( 3 , person.getAge()) ; stmt.setString( 4 , person.getPin()) ;...