title: Java connection to Oracle database
body: <p>I am trying to connect my Java application to Oracle database. I have imported the <strong>OJDBC jar</strong> and <strong>classes12.jar</strong> files in my code but i am getting error <strong>"unable to connect"</strong> <strong>"DB:connectDB()=sun.jdbc.odbc.JdbcOdbcDriver"</strong></p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>static Connection m_Connection = null;
  
      public static void main(String[] args){
  
          if ( connectDB ( "jdbc:oracle:thin:@10.50.14.12:1521:pliv" , "xxxx" , "xxxx" ) )
              {
                System.out.println("Connected");
              }
          else
            {
              System.out.println("Error Occurred");
              System.out.println ( "Unable to connect PrePaid DB:SORRY" );
            }
      }
  
      public static boolean connectDB ( String url , String username , String password )
        {
          try
          {
            // Step 1: Load the JDBC driver.
            Class.forName ( "sun.jdbc.odbc.JdbcOdbcDriver" );
            // Step 2: Establish the connection to the database.
            DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
            m_Connection = DriverManager.getConnection ( url , username , password );
  
  
          }
          catch ( Exception e )
          {
  
            System.err.println ("DB:connectDB()=" + e.getMessage () );
            //new SMSAlert ("DB:connectDB()=" + e.getMessage());
            return false;
          }
  
          return true;
        }
  </code></pre>
  
  <p><strong>Screenshot of the jar files in lib folder.</strong> 
  <img src="https://i.stack.imgur.com/HucFG.png" alt="enter image description here"></p>
  
  <p>Am I missing something here? your kind help would be appreciated.</p>