I am creating a class to connect to my oracle database. But as information I have to access from my bank is: User, password, host, port, and the name of the service, I am trying to connect to the bank and I return the next error:
java.sql.SQLException: Exceção de E/S: The Network Adapter could not establish the connection
Class:
private static final String DEFAULT_URL = "jdbc:oracle:thin:@//rachml-scan.redetendencia.com.br:1521:backofficeint.redetendencia.com.br";
//HOST:rachml-scan.redetendencia.com.br
//Port: 1521
//Service Name: backofficeint.redetendencia.com.br
private static final String DEFAULT_USERNAME = "";
private static final String DEFAULT_PASSWORD = "";
public Connection getConnection() throws ClassNotFoundException, SQLException
{
Connection conn = null;
try
{
Class.forName("oracle.jdbc.OracleDriver");
conn = DriverManager.getConnection(DEFAULT_URL,DEFAULT_USERNAME,DEFAULT_PASSWORD);
}
catch (ClassNotFoundException erroClass) {
System.out.println("Classe Driver JDBC não foi localizado, erro = "
+ erroClass);
}
catch (SQLException erroSQL) {
System.out.println("Erro de conexão com o Banco de dados, erro = "
+ erroSQL);
}
return conn;
}
Does anyone know u solution?