0

Just looking for some pointers really as I am totally new to UniData...

I am after pulling a table (if that is the right terminology??) from a UniData DB. The easiest way it seems is to do this using XML, which seems to be built in to the UniObjects API and UniData.

However, when using the API no XML is returned, just an empty XML error and when using UniCommand.command nothing at all is returned, just command status 0.

There seems to be some conflicting info here - some developers guides suggest the XML gets written to a file and not returned to the client?

Any pointers?

Cheers,

Kai.

UPDATE - Some code...

U2Connection con = new U2Connection();
U2ConnectionStringBuilder conn_str = new U2ConnectionStringBuilder();

try
{
    conn_str.UserID = "BLAH-BLAH";
    conn_str.Password = "BLAH-BLAH";
    conn_str.Server = "BLAH-BLAH";
    conn_str.AccessMode = "Native";   // FOR UO
    conn_str.RpcServiceType = "udcs"; // FOR UO
    conn_str.Database = "BLAH-BLAH";
    conn_str.ServerType = "UNIDATA";
    conn_str.Pooling = false;
    con.ConnectionString = conn_str.ToString();
}
catch (Exception ex)
{

}

con.Open();
UniSession us = con.UniSession;
UniCommand unicmd = us.CreateUniCommand();

unicmd.Command = "LIST ASSET_REPORT";
unicmd.Execute();

Console.Write(unicmd.CommandStatus + Environment.NewLine);
Console.Write(unicmd.Response);
Console.Write(Environment.NewLine + "Done...");
Console.ReadKey();

con.Close();

Just to confirm, with the above code I can execute commands and retrieve their output. However, if I change the command to something like "LIST ASSET_REPORT TOXML" (as per all the guides I have found) I get nothing back. Equally, if I use the UniXML functions:

UniXML xml = us1.CreateUniXML();

xml.GenerateXML("LIST DICT ASSET");

DataSet ds = xml.GetDataSet();

All I get are empty dataset exceptions?

kaigoh
  • 500
  • 3
  • 11
  • Hi kaigoh. Can you post the code you are attempting to use as there are many ways to use and retrieve XML from UniData. Also, generally they are called files, but tables is fine as well :) – Dan McGrath Jan 09 '13 at 01:00

1 Answers1

0

In principle there is nothing wrong with your code. I have tested your code against my UniData server (of course changing file names etc) and I do not get any errors. I am also able to use TOXML and the UniXML method GenerateXML() without any problems. The XML data returned is exactly as I would expect.

Please share the following info with us:

  • Details of all occuring error messages.
  • Version of UniData you are using and OS on which UniData is based.
  • What is the value of unicmd.Response after calling the Execute() method? Are you referencing an empty file and just getting the root tags back?

It really must be something you have not yet shared with us that is causing the problem.

Glenn

Glenn Sallis
  • 415
  • 3
  • 11
  • Bearing in mind that I am totally inexperienced with UniData - is there some account permission that would prevent me from using the XML functionality? I have just downloaded and installed the personal edition of UniData on a machine I have control over (the code above is being executed against a machine I have limited account access to) and my code works perfectly. To answer your questions, no error messages are returned when using UniCommand.command, the server is running on Windows and is version 7.3, unicmd.Response returns nothing when the command is suffixed with TOXML. – kaigoh Jan 09 '13 at 17:59
  • 1
    There shouldn't be. You can get more debug information from the server side of the UniObjects connection by creating a file called `serverdebug` in the home directory of UniData. For windows that is `c:\u2\ud73\` by default. In this file you want to put a single line of text: `udcs 9 E:\U2\ud73\log\udcs\udcs.log`. The only thing I can think of is `us1` doesn't have an active session (I noticed you used `us` where it worked. Try checking for error statuses from `xml`. – Dan McGrath Jan 10 '13 at 04:44
  • Have you managed to solve this problem? I am sure we would be interested to know what the solution was, if you have found one. – Glenn Sallis Jan 14 '13 at 10:13