Query of movies in Mysql - JDBC
When I try to run my code, gives the mensage "Connection refused: connection", I have another code of Update command sql that has the same URL, username and password, and it sucessfully runs.
What's wrong with my code?
import java.sql.*;
/**
*
* @author claud
*/
public class Selecionar {
static final String DRIVER = "com.mysql.cj.jdbc.Driver";
static final String URL = "jdbc:mysql://localhost:3037/usuarios";
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName(DRIVER);
Connection con = DriverManager.getConnection(URL, "root", "Ukul@eiscool");
PreparedStatement ps = con.prepareStatement("Select * from filmes WHERE id > ? order by id desc");
ps.setString(1, "1");
ResultSet rs = ps.executeQuery();
System.out.println("id Nome");
System.out.print("* **********");
while(rs.next()){
String id = rs.getString("id");
String nome = rs.getString("nome");
System.out.println(id + " " + nome);
}
}
}