Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Apache Axis + JDBC Error + Project

  • 18-12-2008 12:21AM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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