title: io error:network adapter could not establish the connection
body: <p>I am developing a mini project using Java and Oracle XE database.
  I was able to connect to database, insert, update and run all other queries from my personal computer, but when I tried to run the same program on my college computer (which is networked) it did not run and gave me the following exception message:</p>
  
  <pre><code>io error:network adapter could not establish the connection
  </code></pre>
  
  <p>I tried researching the error message on the internet and found that it must be a firewall or port number problem, but I am unable to sort it. How can I fix this error?</p>
  
  <p>Here is the connection code that I used:</p>
  
  <pre><code>public void connect()
  {
      try
      {
          Class.forName("oracle.jdbc.driver.OracleDriver");
          conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","system");
      }
      catch(Exception e)
      {
          JOptionPane.showMessageDialog(this, e.getMessage());
      }
  }
  
  SimpleDateFormat sd=new SimpleDateFormat("dd-MM-yy");
  DefaultTableModel table_allrec;
  PreparedStatement pstmt,pstmt1;
  Connection conn;
  ResultSet rs,rs1;
  </code></pre>