title: webservice: error in code or connection
body: <p>I have a problem in my code or connection I think...</p>
  
  <p>I tried to connect to a MySQL database and web service, but when I run the program, it gives me the following error:</p>
  
  <p><a href="http://www6.0zz0.com/2009/04/17/13/808603628.jpg" rel="nofollow noreferrer">alt text http://www6.0zz0.com/2009/04/17/13/808603628.jpg</a></p>
  
  <blockquote>
    <p>@WebService()
    public class LostNumWebService {</p>
  </blockquote>
  
  <pre><code>/**
   * Web service operation
   */
  @WebMethod(operationName = "getCategory")
  public List getCategory(@WebParam(name = "city_name")
  String city_name) {
      List cityName = null;
      try{
          String url = "jdbc:mysql://localhost:3306/mobileapplication";
          Connection conn = DriverManager.getConnection(url,"***","***");
          Statement stmt = conn.createStatement();
          ResultSet rs;
          rs = stmt.executeQuery("SELECT city_id, city_name FROM city WHERE city_name = $city_name");
          while ( rs.next() ) {
              String lastName = rs.getString("city_name");
              cityName.add(lastName);
             // System.out.println(lastName);
          }
          conn.close();
  
      } catch (Exception e) {
          System.err.println("Got an exception! ");
          System.err.println(e.getMessage()); 
      }
  
  
      return cityName;
  }
  </code></pre>
  
  <p>I don't know what's the error, the connection or the code?
  Can i get some help here, please? </p>