Skip to Main Content

Cloud Platform

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to embed URL of deployed java servlet into Android code

2630405Mar 31 2014 — edited Apr 1 2014

I have deployed my servlet code on cloud which access the database cloud , but when i try to access the URL of deployed application , it asks for my credentials (username and password)....

Now that i want to embedd my servlet link on cloud to my android app code , how to escape the credentials , or is their any way so that i can add my username and password in my servlet code itself. This is my servlet code and it is working fine..

Context ctx = null;

        Hashtable ht = new Hashtable();

        ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");

        Connection conn = null;

        Statement stmt = null;

        ResultSet rs = null;

        // out.print("system");

        try {

            ctx = new InitialContext(ht);

            javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("javatrial5196db");

          //  out.print(ds.toString());

            conn = ds.getConnection();

            stmt = conn.createStatement();

            rs = stmt.executeQuery("select * from test");

            while (rs.next()) {

                out.println(rs.getString("id") + "   " + rs.getString("password") + "<br>");

            }

            conn.close();

            stmt.close();

        } catch (Exception e) {

            out.print(e);

        }

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2014
Added on Mar 31 2014
1 comment
1,180 views