Question

I have installed Oracle 12c on a Windows 2012 Server box, and can connect to a database I created with it just fine using SQL Developer running on the server itself. However, I cannot connect to the same database from a remote machine, which is what I was wanting to do. I use SQuirreL, SQL Developer, and even run Java code to connect to the box from an external client, and each attempt times out - so I know that I have my connection url correct (jdbc:oracle:thin:@192.168.0.105:1521:orcl), and that there is something amiss on the server itself.

Is there a set of instructions that someone can point me to in order to allow my database to be reachable from the outside?

Here is my listener.ora file contents on the server:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\app\dbadmin\product\12.1.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\app\dbadmin\product\12.1.0\dbhome_1\bin\oraclr12.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.105)(PORT = 1521))
    )
  )

The error I am getting is as follows (timeout error, as said above):

java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:673)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:715)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564)
    at java.sql.DriverManager.getConnection(DriverManager.java:571)
    at java.sql.DriverManager.getConnection(DriverManager.java:215)
    at Launcher.main(Launcher.java:47)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:445)
    at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:464)
    at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:594)
    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:229)
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1360)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:486)
    ... 7 more
Caused by: java.net.SocketTimeoutException: connect timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:162)
    at oracle.net.nt.ConnOption.connect(ConnOption.java:133)
    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:411)
    ... 12 more

This question has been asked once or twice on StackOverflow already, but I've tried most of the answers that I have found and I still cannot connect to my Oracle 12c database from the outside. There are a few commands in sql*plus that I've tried (http://technology.amis.nl/2013/06/26/oracle-12c-getting-started-with-db-express/) with still no success. I'm sure it's just some setting like firewall or something else like that, but would like feedback from experienced persons if possible.

Any help much appreciated.

Was it helpful?

Solution

You suggested a firewall might be the issue, and a connection timeout on a local network certainly makes it sound like that could be the case, assuming the IP address and port number are correct.

If so you need to open up port 1521 in the firewall. There's a Microsft article showing how to do that for SQL Server; the process is the same, just for a different port number. Or more general instructions for opening any port:

  1. Open Windows Firewall by clicking the Start button , and then clicking Control Panel. In the search box, type firewall, and then click Windows Firewall.

  2. In the left pane, click Advanced settings. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.

  3. In the Windows Firewall with Advanced Security dialog box, in the left pane, click Inbound Rules, and then, in the right pane, click New Rule.

  4. Follow the instructions in the New Inbound Rule wizard.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top