0

Java Webservice コードがあります。現在、ローカルホストで実行しています。これを別のサーバー(静的IPを使用)で実行する場合、どのような変更を加える必要がありますか。

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.PreparedStatement;

public class RetailerWS {
 public String customerData(){
  String customerInfo = "";
  try{
  Class.forName("com.mysql.jdbc.Driver");
  Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/retailer","root","chathura");
  //Find customer information where the customer ID is maximum
  PreparedStatement statement =  con.prepareStatement("SELECT * FROM customers WHERE C_ID = (SELECT MAX(C_ID) FROM customers)");
  ResultSet result = statement.executeQuery();

   while(result.next()){
    customerInfo = customerInfo + result.getString("name") + "&" + result.getString("C_ID") + "&"+result.getString("address") + "&"+result.getString("email");
  //Here "&"s are added to the return string. This is help to split the string in Android application
   }
  }

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

  return customerInfo;
  }

}
4

1 に答える 1