eclipse - Cannot access MSSQL using web service(Exception: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver) -


i have created basic web service using eclipse access 1 of databases , run simple query. when create web service in eclipse , test client, returns me exception

exception: java.lang.classnotfoundexception: com.microsoft.sqlserver.jdbc.sqlserverdriver 

i have done following:

  1. use same code in different independent java class , runs fine. database return results. no exceptions.
  2. i have added classpath in eclipse runtime when creating web service (as did when tested step 1 above).

this sample code in eclipse wrote , generate webservice from:

    package testservice;     import java.sql.*;      import javax.jws.webservice;     @webservice      public class testserv {     public string testsql() throws sqlexception, classnotfoundexception{         string answer = "ok";         class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver");           connection conn = drivermanager.getconnection                           ("jdbc:sqlserver://192.168.69.207;user=sa;password=test123; database=testdb");         //system.out.println("test");         statement sta = conn.createstatement();         string sql = "select * qem_message";         resultset rs = sta.executequery(sql);         while (rs.next()) {             //system.out.println(rs.getstring("currentstatus"));     }     return answer;     }} 

after create webservice , invoke test client, result is:

exception: java.lang.classnotfoundexception: com.microsoft.sqlserver.jdbc.sqlserverdriver message: java.lang.classnotfoundexception: com.microsoft.sqlserver.jdbc.sqlserverdriver  

the same code runs fine in independent java class.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -