title: ClassNotFound Exception while Calling through JAVA Web Service?
body: <p>i have java class in which i have done database connection for SQL server and trying to retrieve data from table its working fine. but now i created web service in java for that class then its showing me <code>ClassNotFoundException :net.sourceforge.jtds.jdbc.Driver</code> i have import external jar as well.
    Actually i need to show data from database to Android layout that's why i created web service which will helpful to retrieve data from database.
  But when i am trying to retrieve data from database then Drivers are not loading.its showing above error.
  i also tried like following :</p>
  
  <pre><code>//DatabaseConnetivityClass.java
  
  public class DatabaseConnetivityClass 
      {
       public static void main(String Args[])
       {
             new DatabaseConnetivityClass().getData();
       }
       public String getData()
       {
         String s = null;
         try {
          s = new MainConnection().getData();
         } catch (SQLException e) {           
          e.printStackTrace();
      }
      return s;
    }
   }
  </code></pre>
  
  <p>MainConnection.java</p>
  
  <pre><code>public class MainConnection {
  Connection con;
  public MainConnection() {
      try{
      Class.forName("net.sourceforge.jtds.jdbc.Driver");
      con=DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/databasename","username","password");
      }
      catch (Exception e) {
          System.out.println("exp:"+e);
      }
  }
  
  public String getData() throws SQLException {
      StringBuffer sb = new StringBuffer();
      Statement select = con.createStatement();
      ResultSet result = select.executeQuery("SELECT * FROM Personal_Info");
      while (result.next()) {
          // process results one row at a time
  
          String val = result.getString(1);
          sb.append(val);
          System.out.println("val = " + val);
      }
      select.close();
      return sb.toString();
  }}
  </code></pre>
  
  <p>i thought it will work but its giving the same error.
  So please help me if anybody knows the solution</p>