I am trying to connect android application to oracle12c sql server through jdbc. Android don't find oracle.securitypki and javax.management class files while loading jdbc. And I also checked that these class files don't exist in jdbc driver.
Please can anyone help me how can I make connection possible using jdbc. And I also want to mention that I have included internet permission in android manifest file.
Here is code:
import android.os.Bundle;
import android.widget.TextView;
import android.app.Activity;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
public class MainActivity extends Activity
{
TextView text;
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text=(TextView)findViewById(R.id.txt_2);
Connection conn=null;
String url="jdbc:oracle:thin:@192.168.1.16:1521:MyDatabase";
String username="system";
String password="xxxxx";
String driver="oracle.jdbc.driver.OracleDriver";
try
{
Class.forName(driver).newInstance();
conn=DriverManager.getConnection(url, username, password);
Statement statement=conn.createStatement();
ResultSet resultset=statement.executeQuery("select * from student");
resultset.next();
text.setText("Hello "+resultset.getString(1));
}
catch(Exception ex)
{
text.setText("Exception: "+ex.getCause());
}
}
}
Exceptions: Colud not find class oracle.security.pki.OraclePkiProvider. could not find class javax.management.MBeanServer.