title: Android - Oracle 12c Database Connection Issue : java.sql.SQLException: ORA-28040: No matching authentication protocol
body: <p>Since last 3 days I am getting problem with just simple connection of <strong>Android - Oracle 12c Database.</strong> </p>
  
  <p>Recently I have uploaded <strong><a href="https://github.com/pratikbutani/Android-Oracle-Connection" rel="nofollow noreferrer">Android-Oracle-Connection</a></strong> but its for 11g version. I have used <strong>ojdbc14.jar</strong></p>
  
  <p>I have used following lines of code in that demo:</p>
  
  <pre><code>/**
   * Driver for Oracle
   */
  private static final String DEFAULT_DRIVER = "oracle.jdbc.driver.OracleDriver";
  
  
  /**
   * URL to connect database
   */
  private static final String DEFAULT_URL = "jdbc:oracle:thin:@192.168.0.102:1521:oracle"; // Change IP_Address:Database
  
  /**
   * Creating Connection
   *
   * @param driver   driver object
   * @param url      url for db
   * @param username username
   * @param password password
   * @return Connection object
   * @throws ClassNotFoundException throwing exception
   * @throws SQLException           throwing exception
   */
  public static Connection createConnection(String driver, String url, String username, String password) throws ClassNotFoundException, SQLException {
      Class.forName(driver);
      return DriverManager.getConnection(url, username, password);
  }
  </code></pre>
  
  <p>Now Problem is, I am using IP : <strong>192.168.0.102</strong> for 11g which was successfully connected but I have change IP <strong>192.168.0.105</strong> for 12c with same code but its not working.</p>
  
  <p>I am getting error as:</p>
  
  <pre><code>java.sql.SQLException: ORA-28040: No matching authentication protocol
  </code></pre>
  
  <p>I have already <a href="https://stackoverflow.com/a/26604277/1318946">checked this answer</a> and tried but getting error as:</p>
  
  <pre><code>W/oracle.jdbc: Error while registering Oracle JDBC Diagnosability MBean.
      java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/management/ManagementFactory;
          at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:321)
          at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:203)
          at java.security.AccessController.doPrivileged(AccessController.java:43)
          at oracle.jdbc.driver.OracleDriver.&lt;clinit&gt;(OracleDriver.java:199)
          at java.lang.Class.classForName(Native Method)
          at java.lang.Class.forName(Class.java:454)
          at java.lang.Class.forName(Class.java:379)
  </code></pre>
  
  <p>I have already <a href="https://stackoverflow.com/a/50981073/1318946">tried this answer</a> too but getting error as:</p>
  
  <pre><code>2019-11-23 16:36:12.564 28567-28567/com.demo.oracle E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.demo.oracle, PID: 28567
      java.lang.NoSuchMethodError: No static method metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (declaration of 'java.lang.invoke.LambdaMetafactory' appears in /apex/com.android.runtime/javalib/core-oj.jar)
          at oracle.jdbc.driver.OracleDriver.&lt;clinit&gt;(OracleDriver.java:230)
          at java.lang.Class.classForName(Native Method)
          at java.lang.Class.forName(Class.java:454)
          at java.lang.Class.forName(Class.java:379)
  </code></pre>
  
  <p>I didn't found any tutorial or documentation to connect with 12c. Can anyone help?</p>