Announcement Announcement Module
Collapse
No announcement yet.
handling xml results from storedprocedure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • handling xml results from storedprocedure

    hi
    I need to call a stored procedure and the results I'm expecting in xml format.
    How do i persisit these xmlresults ,can somebody put me in right direction?or may be a sample pelase.

    thanks
    AD

  • #2
    I don't understand. The stored procedure is going to return XML and you want to know how to persist the XML?
    Last edited by karldmoore; Aug 30th, 2007, 06:29 AM.

    Comment


    • #3
      yes karldmore

      right now i have the code like this but this is map of result set which I'm processing , but I'm, expecting now results in xml format, how to persist them.

      present code
      Code:
      private class MyStoredProcedure extends StoredProcedure {
      		
      		/** Name of procedure in database. */
      		public static final String PROC_NAME = "sp_customerLookup";
      
      		//private int count = 0;
      		
      		/**
      		  * Constructor for this StoredProcedure class.
      		  * @param ds Data Source.
      		  */
      
      
      		public MyStoredProcedure(DataSource ds) {
      			setDataSource(ds);
      			setFunction(false);
      			setSql(PROC_NAME);
      
      			
      			declareParameter(new SqlReturnResultSet("rs", new RowMapper() {
      				public Object mapRow(ResultSet rs, int rowNum)
      						throws SQLException {
      					Map data = new HashMap(1);
                      //	 add more mappings here
      					data.put("id", rs.getString(1));
      					data.put("firstname", rs.getString(2));
      					data.put("lastname", rs.getString(3));
      					data.put("dob", rs.getString(4));
      					
      					return data;
      				}
      			}));
      			
                     // Parameters should be declared in same order here that
      			   // they are declared in the stored procedure.
      			declareParameter(new SqlParameter("id", Types.INTEGER));
      			declareParameter(new SqlParameter("surname", Types.VARCHAR));
      			declareParameter(new SqlParameter("firstname", Types.VARCHAR));
      			declareParameter(new SqlParameter("dob", Types.VARCHAR));
      			compile();
      		}
      
      public Map execute(Integer id,String lName, String fName,String dob) {
      			Map in = new HashMap();
      			in.put("id", id);
      			in.put("surname", lName);
      		    in.put("firstname", fName);
      			in.put("dob", dob);
      
      			Map out = execute(in);
      			return out;
      		}

      Comment


      • #4
        Are you saying the ResultSet currently returns String's but you are now going to be returning an XML type? You want to know how to read that out?
        Last edited by karldmoore; Aug 30th, 2007, 06:29 AM.

        Comment


        • #5
          yes karldmore

          Comment


          • #6
            I've never used this myself, but I'm sure there have been posts on here in the past related to this. You might want to do a search.
            Last edited by karldmoore; Aug 30th, 2007, 06:29 AM.

            Comment

            Working...
            X