Since last 3 days I am getting problem with just simple connection of Android - Oracle 12c Database.
Recently I have uploaded Android-Oracle-Connection but its for 11g version. I have used ojdbc14.jar
I have used following lines of code in that demo:
/**
* 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);
}
Now Problem is, I am using IP : 192.168.0.102 for 11g which was successfully connected but I have change IP 192.168.0.105 for 12c with same code but its not working.
I am getting error as:
java.sql.SQLException: ORA-28040: No matching authentication protocol
I have already checked this answer and tried but getting error as:
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.<clinit>(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)
I have already tried this answer too but getting error as:
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.<clinit>(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)
I didn't found any tutorial or documentation to connect with 12c. Can anyone help?
ojdbc7.jar
should work for you, available here: oracle.com/database/technologies/jdbc-upc-downloads.html – Intuit