hii all. i am trying to connect to my database using url connection is
working fine.but i am using httpclient its not working.
my URL is  *http://122.166.229.173:8080/indela/ServletDataBase*
in server side i wrote program in servelets.


this code is corking fine. getting results also.

*URL url = new URL(FETCH_FRIEND_UPDATES_URI);*
*            URLConnection connection = url.openConnection();*
*            connection.setDoInput(true);*
*            connection.setDoOutput(true);*
*            connection.setUseCaches(false);*
*            connection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");*
*            DataInputStream dataIn = new
DataInputStream(connection.getInputStream());*
*            String inputLine;*
*            String result="";*
*            while ((inputLine = dataIn.readLine()) != null) {*
*            result += inputLine;*
*            }*
*            dataIn.close();*
*            *
this code is not getting results.
*
*
*
 HttpEntity entity = null;
            entity = new UrlEncodedFormEntity(params);
            final HttpPost post = new HttpPost(FETCH_FRIEND_UPDATES_URI);
            post.addHeader(entity.getContentType());
            post.setEntity(entity);
            maybeCreateHttpClient();

            final HttpResponse resp = mHttpClient.execute(post);
            final String response = EntityUtils.toString(resp.getEntity());

public static void maybeCreateHttpClient() {
        if (mHttpClient == null) {
            mHttpClient = new DefaultHttpClient();
            final HttpParams params = mHttpClient.getParams();
            HttpConnectionParams.setConnectionTimeout(params,
                REGISTRATION_TIMEOUT);
            HttpConnectionParams.setSoTimeout(params, REGISTRATION_TIMEOUT);
            ConnManagerParams.setTimeout(params, REGISTRATION_TIMEOUT);
        }
    }
actually i my application i need to pass some parameters to the server side
table because whereClause .

please give me some code to connect to my url.

thanks in advance.....

*

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to