I've been trying to setup remote connection for a while now using the database host ip address in my java application in order to connect remotely and send it SQL queries. Here is the method I'm using to setup connection:
public static Connection openCon ()
{
try {
//load the driver class
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@192.168.1.24:1521/orclpdb";
String user = "TAGCOMPDBA";
String pass = "minigrr1";
//create the connection object
Connection con = DriverManager.getConnection(url, user, pass);
System.out.println("Connection made to PDB");
return con;
}
catch(Exception e) {
System.out.print(e);
return null;
}
}
When I run my program this error is given:
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
I've attempted editing my listener.ora to add my ip address as an address. I also edited my tnsnames.ora to have an entry with my ip address as the host and I made sure my firewall was not blocking the port. None of this has worked and I have no idea where to go from here. Perhaps I'm not understanding something?