Java.sql.SQLException: Exceção de E/S: The Network Adapter c

2 respostas
P

java.sql.SQLException: Exceção de E/S: The Network Adapter could not establish the connection

O que este erro quer dizer
Eu tentei fazer a conexão da seguinte forma

try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException e) { System.out.println("Não foi possível carregar o driver"); } try { con = DriverManager.getConnection( "jdbc:oracle:thin://host:1521/nome_base","user","senha"); } catch (SQLException e) { System.out.println("não foi possível fazer a conexão com a base de dados"+e); }

2 Respostas

caiofilipini

Essa URL é válida?

jaqs

a url está errada… é

public static Connection getConnection() throws SQLException {

try {

Class.forName(oracle.jdbc.driver.OracleDriver);

System.out.println(Conectando ao banco);

return DriverManager.getConnection(jdbc:oracle:thin:@localhost:1521:SID,

user, pass);

} catch (ClassNotFoundException e) {

throw new SQLException(e.getMessage());

}

}
Criado 13 de abril de 2004
Ultima resposta 20 de out. de 2006
Respostas 2
Participantes 3