I'm trying to connect a DB from Postgres with a program in Java. I'm including this code:

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?

What "using" statements do you have?

I've this "imports"

import java.beans.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;

The import java.beans.Statement is wrong . You have to import java.sql.Statement .