I'm trying to connect a DB from Postgres with a program in Java. I'm including this code:
Class.forName(driver);
Connection con = DriverManager.getConnection(connectString, user , password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM students");
But I'm getting this erros in Statemen and stmt.excuteQuery:
With Statement: incompatible types. Required: java.beans.Statement. Found: java.sql.Statement
With .executeQuery: Cannot find symbol. Symbol: method executeQuery (java.lang.String). Location: class java.beans.Statement
In all the tutorials they include this code and they don't seem to have any problem. Any idea what can I do?