• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

retrieve data from mysql

krishnaveni

Well-Known Member
Hi.,
i have retrieve value from mysql database using soap webservices in a ndroid application.Here the following code are used.

the webservice code is:
Code:
public class RetailerWs {

public String customerData(){
String customerInfo = "";
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pro","root","");

PreparedStatement statement =  con.prepareStatement("[B]select * from orders where status='Q' AND date='2012-08-01[/B]'");
 ResultSet result = statement.executeQuery();

 while(result.next()){
 int count=0;
 count++;

 [B]System[/B][B].out.println(count);[/B]

  // customerInfo = customerInfo + result.getString("orderid") + "&" +       result.getString("login");

   }
   }

  catch(Exception exc){
  System.out.println(exc.getMessage());
  }

   return customerInfo;
   }

    }
The android code is:
Code:
HttpTransportSE ht = new HttpTransportSE(URL);
try {
    ht.call(SOAP_ACTION, envelope);
    SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
    SoapPrimitive s = response;
    [B]String str [/B][B]= s.toString();
    String resultArr[] = str.split("&");

    [/B]TextView tv = new TextView(this);

    for(int i = 0; i<resultArr.length;i++){
    tv.append(resultArr[i]+"\n\n");
   }
    setContentView(tv);

 } catch (Exception e) {
    e.printStackTrace();
 }
 }
Here i have to display count number.but i can't do develop dis.so please help me where i can change code part.Here the android code have to change.because in my webservice code
System.out.println(count);.

in webservice code doesnot string.then why am used
String str = s.toString();
String resultArr[] = str.split("&");
dis line.so please how is developed the above code.Finally i wish to need the count value is displayed on my android application.
If i run the android application means the count value is displayed apache tomcat.but not displayed on my android application.
 
Back
Top Bottom