title: Connect Oracle through Java program
body: <p>I am trying to connect to Oracle 11g through Java program.Below is my code:-</p>
  
  <pre><code>    String dbUrl = "jdbc:oracle://localhost:1521/orcl"; 
  
  
      //Database Username     
      String username = "abc";    
  
      //Database Password     
      String password = "abc";                
  
      //Query to Execute      
      String query = "select *  from jobs;";
  
      //Load mysql jdbc driver        
      Class.forName("oracle.jdbc.driver.OracleDriver");       
  
      //Create Connection to DB       
      Connection con = DriverManager.getConnection(dbUrl,username,password);
  
      //Create Statement Object       
     Statement stmt = con.createStatement();                  
  
          // Execute the SQL Query. Store results in ResultSet        
      ResultSet rs= stmt.executeQuery(query); 
  </code></pre>
  
  <p>However i am getting an error message as-
  Exception in thread "main" java.sql.SQLException: Invalid Oracle URL specified
      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:448)</p>
  
  <p>Please note:I did attach the ojdbc6.jar.</p>
  
  <p>Can you please let me know if i am missing anything?</p>