<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Java AXL ExecuteSQL returning row:null in Management</title>
    <link>https://community.cisco.com/t5/management/java-axl-executesql-returning-row-null/m-p/4042973#M3340</link>
    <description>&lt;P&gt;I am trying to return results from a query and the data is null.&amp;nbsp; I get the correct amount of rows for the data being returned, but the text data is null.&amp;nbsp; When I change the code to print the length of the data, it is always 0.&amp;nbsp; When I log into the CUCM API directly and do a "run sql" data comes back.&amp;nbsp; Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ExecuteSQLQueryReq query = new ExecuteSQLQueryReq();&lt;BR /&gt;&lt;BR /&gt;// Prepare a ListUserRes object to receive the response from AXL&lt;BR /&gt;ExecuteSQLQueryRes getSQLResponse;&lt;BR /&gt;&lt;BR /&gt;// Set the query&lt;BR /&gt;query.setSql("select pkid from enduser");&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;try {&lt;BR /&gt;getSQLResponse = axlPort.executeSQLQuery(query);&lt;BR /&gt;&lt;BR /&gt;user_list = getSQLResponse.getReturn().getRow();&lt;BR /&gt;} catch (Exception e) {&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;for (int x = 0; x &amp;lt; user_list.size(); x++) {&lt;BR /&gt;Element el = (Element)user_list.get(x);&lt;BR /&gt;&lt;BR /&gt;System.out.println(el.getElementsByTagName("row").getLength());&lt;BR /&gt;//System.out.println(el.getElementsByTagName("row").item(x).getFirstChild().getTextContent());&lt;BR /&gt;}&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Mar 2020 17:56:48 GMT</pubDate>
    <dc:creator>Roberts32364</dc:creator>
    <dc:date>2020-03-09T17:56:48Z</dc:date>
    <item>
      <title>Java AXL ExecuteSQL returning row:null</title>
      <link>https://community.cisco.com/t5/management/java-axl-executesql-returning-row-null/m-p/4042973#M3340</link>
      <description>&lt;P&gt;I am trying to return results from a query and the data is null.&amp;nbsp; I get the correct amount of rows for the data being returned, but the text data is null.&amp;nbsp; When I change the code to print the length of the data, it is always 0.&amp;nbsp; When I log into the CUCM API directly and do a "run sql" data comes back.&amp;nbsp; Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ExecuteSQLQueryReq query = new ExecuteSQLQueryReq();&lt;BR /&gt;&lt;BR /&gt;// Prepare a ListUserRes object to receive the response from AXL&lt;BR /&gt;ExecuteSQLQueryRes getSQLResponse;&lt;BR /&gt;&lt;BR /&gt;// Set the query&lt;BR /&gt;query.setSql("select pkid from enduser");&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;try {&lt;BR /&gt;getSQLResponse = axlPort.executeSQLQuery(query);&lt;BR /&gt;&lt;BR /&gt;user_list = getSQLResponse.getReturn().getRow();&lt;BR /&gt;} catch (Exception e) {&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;for (int x = 0; x &amp;lt; user_list.size(); x++) {&lt;BR /&gt;Element el = (Element)user_list.get(x);&lt;BR /&gt;&lt;BR /&gt;System.out.println(el.getElementsByTagName("row").getLength());&lt;BR /&gt;//System.out.println(el.getElementsByTagName("row").item(x).getFirstChild().getTextContent());&lt;BR /&gt;}&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Mar 2020 17:56:48 GMT</pubDate>
      <guid>https://community.cisco.com/t5/management/java-axl-executesql-returning-row-null/m-p/4042973#M3340</guid>
      <dc:creator>Roberts32364</dc:creator>
      <dc:date>2020-03-09T17:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Java AXL ExecuteSQL returning row:null</title>
      <link>https://community.cisco.com/t5/management/java-axl-executesql-returning-row-null/m-p/4043704#M3341</link>
      <description>&lt;P&gt;I was able to get this working as below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;import com.sun.org.apache.xerces.internal.dom.ElementNSImpl;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;// Create an iterator to cycle through each row, below
Iterator&amp;lt;Object&amp;gt; itr = user_list.iterator();

// While the iterator indicates there is at least one more row...
while ( itr.hasNext() ) {

    // The individual row object is of this ElementNSImpl type - we'll need to cast from generic Object here
    ElementNSImpl el = ( ElementNSImpl )itr.next();

    // Print out the formatted name and pkid values
    System.out.println(
        "Name: " + String.format( "%-20s", el.getElementsByTagName( "name" ).item( 0 ).getTextContent() ) +
        "PKID: " + el.getElementsByTagName( "pkid" ).item( 0 ).getTextContent() );
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Added to the collection of samples here: &lt;A href="https://github.com/CiscoDevNet/axl-java-samples" target="_blank"&gt;https://github.com/CiscoDevNet/axl-java-samples&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 20:08:02 GMT</pubDate>
      <guid>https://community.cisco.com/t5/management/java-axl-executesql-returning-row-null/m-p/4043704#M3341</guid>
      <dc:creator>dstaudt</dc:creator>
      <dc:date>2020-03-10T20:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Java AXL ExecuteSQL returning row:null</title>
      <link>https://community.cisco.com/t5/management/java-axl-executesql-returning-row-null/m-p/4044162#M3342</link>
      <description>Thank You! It work perfectly and I appreciate the help. I have been staring at my code for 3 days. I guess need to brush up on my Java web services.</description>
      <pubDate>Wed, 11 Mar 2020 12:26:16 GMT</pubDate>
      <guid>https://community.cisco.com/t5/management/java-axl-executesql-returning-row-null/m-p/4044162#M3342</guid>
      <dc:creator>Roberts32364</dc:creator>
      <dc:date>2020-03-11T12:26:16Z</dc:date>
    </item>
  </channel>
</rss>

