Connecting Android with Oracle server -
i trying connect android application oracle12c sql server through jdbc. android don't find oracle.securitypki , javax.management class files while loading jdbc. , checked these class files don't exist in jdbc driver.
please can me how can make connection possible using jdbc. , want mention have included internet permission in android manifest file.
here 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 * 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. not find class javax.management.mbeanserver.
Comments
Post a Comment