Когда я пытаюсь запустить свой код, выдает сообщение
Соединение отклонено: соединение
У меня есть другой код команды обновления SQL с тем же URL-адресом, именем пользователя и паролем, и он успешно выполняется.
Что не так с моим кодом?
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);
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... mysql-jdbc