Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Apache Axis + JDBC Error + Project

Options
  • 18-12-2008 1:21am
    #1
    Registered Users Posts: 269 ✭✭


    I am trying to connect using a webservice to a MS Access Database record the webservice is part of Apache Axis Instant Deployment, i recently did a webservice that converts tempature from celcius to fahrenheit using instant deployment and it worked.

    Will i have to use custom deployment i want to do anything with a database if so how can i do it with eclipse also what WSDD i am not all that comfortable with the command line.

    I am getting the following error when trying to retrieve a record from a database
    
    soapenv:Fault>
      <faultcode>soapenv:Server.userException</faultcode> 
      <faultstring>org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.</faultstring> 
    

    Here is my webservice
    I have also provide screen shots of service on tomcat
    import java.lang.Class;
    import java.sql.*;
    public class DatabaseUtility 
    {
    	Connection con;
    	
    	public DatabaseUtility(){
    		try{
    			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    			}
    		catch(ClassNotFoundException e){
    			System.out.println("Error" + e);
    		}
    		
    		try{
    			String url="jdbc:odbc:AddressBook";
    			con=DriverManager.getConnection(url);
    		}
    		
    		catch(Exception e)
    		{
    			System.out.println("Error" + e);
    		}
    		
    	}
    	
    	public String setDatabaseRecord(String name, String address, String telephone, String email, String mobilenumber)
    	{
    	    String record=null;
    		try{
    		Statement stmt = con.createStatement();
    		String insert="INSERT INTO Addressbook VALUES ";
    		String values="('" + name + "','" + address + "','" + telephone + "','" + email + "','" + mobilenumber + "')";
            String sql=insert+values;
            System.out.println(sql);
            int rs = stmt.executeUpdate(sql);
    		record = "Record Entered";
    		stmt.close();
    		}
    		catch(SQLException e){
    			record = "Record Not Entered";
    			System.out.println("Error" + e);
    		}
    		
    	return(record);
    	}
    	public String getDatabaseRecord(String name)
    	{
    		String queryresult=null;
    		try{
    		Statement stmt = con.createStatement();
    		String query="SELECT * FROM AddressBook WHERE Name='" + name + "'";
    		ResultSet result = stmt.executeQuery(query);
    		
    		while(result.next())
    		 {
    			queryresult= result.getString(1)+result.getString(2)+result.getString(3)+result.getString(4)+result.getString(5);
    		 }
    		}
    		catch(SQLException e){
    			 System.out.println("Error" + e);
    		}
    		if(queryresult==null)
    		{
    			queryresult=name + "Is Not Present In AddressBook";
    		}
    		return(queryresult);
    	 }
    	
      }
    
    

    I am currently doing my final year degree project what i am developing is a travel management web service (A number of differnt web service eg Recent travel history service ,miles traveled service etc) that then wraped in BPEL process. The apache documentation is confusing me i did the instant deployment easly enough but that was just a simple java class where i changed the extension to .jws

    Any help would be appreciated


Comments

  • Registered Users Posts: 610 ✭✭✭nialo


    Cant tell you whats wrong with the select but your insert statement will have issues i think because you have not defined the columns you are inserting into.

    INSERT INTO Schema.Table (column1, column2) VALUES (value1, value2)


Advertisement