title: java.sql.SQLException: Io exception: Invalid number format for port number
body: <pre><code>package jdbcconnection;
  
  import java.sql.*;
  
  public class Jdbc2{
  
      public static void main(String[] args) throws Throwable {
  
          //Resgister the driver through 
  
           Class.forName("oracle.jdbc.driver.OracleDriver");
           System.out.println("registered driver successfully");
           //Create the connection and assign to connection reference
           Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:CUSTDB", "scott", "tiger");
           System.out.println("connection successsfully");
           //create a statement through connection reference and assign to statement reference
           Statement stmt=con.createStatement();
           System.out.println("statement object created successfully");
           //call the executequery method through statement reference and pass the query as argument.
           ResultSet rs=stmt.executeQuery("select * from emp");
  
           System.out.println("query is executed");
  
           while(rs.next()){
               int i=rs.getInt(1);
               String str=rs.getString(2);
               String str1=rs.getString(3);
               int i1=rs.getInt(4);
               System.out.println(i+"\t"+str+"\t"+str1+"\t"+i1);    
           }
      }
  }
  </code></pre>
  
  <p>error--</p>
  
  <pre><code>Exception in thread "main" java.sql.SQLException: Io exception: Invalid number format for port number
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
      at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:439)
      at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:165)
      at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at jdbcconnection.Jdbc2.main(Jdbc2.java:13)
  </code></pre>