I have created the web service and in that i am coonecting the database and access the information form that but couldn't successful.
/
**
*
*/
package com.xxxxx.www.testprocess;
import javax.jws.*;
import java.sql.*;
import java.util.*;
/**
* @author Suryasol6
*
*/
@WebService(name="TestProcess",targetNamespace ="http://www.example.org/TestProcess")
public class TestProcess {
private Connection connect = null;
private Statement statement = null;
private PreparedStatement ps = null;
private ResultSet rs = null;
private static final String CONNECTION_URL = "jdbc:mysql://localhost:3306/java_test?user=root&;password=";
@WebMethod(action="http://www.example.org/TestProcess/TestLogin")
@WebResult(name="TestLoginresponse")
public String TestLogin(@WebParam(name="name")
String name,@WebParam(name="password")
String password)
{
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
}
catch(Exception e)
{
return "fail here";
}
return "pass";
}
}
I can publish the web service but when i try to connect the web service with parametes, it fails to load the jdbc driver.
But when i try to run this file as seperate this worked.
Can anybody help me??
Do you have the MySQL driver jar in the JBoss server lib directory? It should go in:
<JBoss_home>/server/default/lib
When you run it manually you may be specifying the classpath to include the jar, but JBoss needs it there.