I'm trying to get an example running on my computer which comes packaged in the C:\IBM\UniDK\uonet\samples\C#
directory. The name of the project is UniSelectList
.
This exact code, works perfectly on just one of our machines.
At first I thought it may be a wrong reference to the DLL file IBMU2.UODOTNET
, but even taking the DLL file from the working machine does not allow it to run.
Each machine is on the same network, all firewalls disabled.
This is the exception message that we're receiving:
SocketException caught!!!SystemNo such host is known[IBM U2][UODOTNET - UNIRPC][ErrorCode=81011] The host name is not valid, or the host is not responding Source: UniRPCConnection Class Method: Void set_Host(System.String) at IBMU2.UODOTNET.UniRPCConnection.set_Host(String value) at IBMU2.UODOTNET.UniSession.Connect()
using System;
using IBMU2.UODOTNET;
namespace IBMU2.Samples.UniSelectListSample
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class UniSelectListSample
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
UniSession us1=null;
try
{
us1 = UniObjects.OpenSession("92.0.0.1","username","password","play/PLAYSMD","uvcs");
UniSelectList sl = us1.CreateUniSelectList(2);
// Select UniFile
UniFile fl = us1.CreateUniFile("SLCUST");
sl.Select(fl);
bool lLastRecord = sl.LastRecordRead;
while(!lLastRecord)
{
string s = sl.Next();
Console.WriteLine("Record ID:" + s);
lLastRecord = sl.LastRecordRead;
}
}
catch(Exception e)
{
if(us1 != null && us1.IsActive)
{
UniObjects.CloseSession(us1);
us1= null;
}
Console.WriteLine("");
string s = "Connection Failed : " + e.Message;
Console.WriteLine(s);
}
finally
{
if(us1 != null && us1.IsActive)
{
Console.WriteLine("");
string s = "Connection Passed";
Console.WriteLine(s);
UniObjects.CloseSession(us1);
}
Console.ReadLine();
}
}
}
}
I can ping the IP address and I can receive a reply.
Am I missing a reference?
I managed to get to the bottom of the problem. It was not referencing properly to the
IBMU2.UODOTNET.dll
file.I think it's because it was not properly registered on my machine.
This is how I registered the DLL properly on my machine (After a bit of research!).
Download the Global Assembly Cache Tool (Gacutil.exe) Docs here
Open command prompt
cd
to the directory which contains the filesgacutil.exe
andUODOTNET.DLL
Enter the following in to the command line:
The message back was something along the lines of "Successfully added to the cache".