.netu2unidatau2netdkrocket-u2

Execute simple select query using Rocket U2 Toolkit for .NET


Executing the following code fails on command.ExecuteReader() with exception:

"ERROR [] [U2] [UCINET-UO] ERROR [] [U2] [UCINET-UO] [U2][UCINET-UO] [U2][UCINET-UO] XTOOLSUB Subroutine failed. Log to Account (2). Invalid account name /data/TSSA9. Make sure /data/TSSA account is listed in ud_database file and UD.ACCOUNT. Class Name = UDAttribute Method Name = GetAttributes(...) Class Name = UDAttribute Method Name = GetAttributes(...) Source:U2.Data.Client TargetSite:U2.Data.Client.NativeAccess.TableInfoForNativeAccess GetTableInformation(U2.Data.Client.U2Command)"

using (var connection = ConnectionFactory.Create())
using (var command = connection.CreateCommand())
{
    command.CommandText = "Select ID From CONTRACTORS;";
    connection.Open();
    using (var reader = command.ExecuteReader())
    {
        while (reader.Read())
        {
            var o = reader[0];
        }
    }
}

public class ConnectionFactory
{
    public const string Password = "****";
    public const string UserName = "****";
    public const string Server = "****";

    public static U2Connection Create()
    {
        var connectionStringBuilder = new U2ConnectionStringBuilder
        {
            UserID = UserName,
            Password = Password,
            Server = Server,
            Database = "/data/TSSA",
            ServerType = "UNIDATA",
            AccessMode = "Native", // FOR UO
            RpcServiceType = "udcs", // FOR UO
            Connect_Timeout = 9000,
            QueryTimeout = 9000,
            PersistSecurityInfo = true,
            Pooling = false
        };

        return new U2Connection
        {
            ConnectionString = connectionStringBuilder.ToString()
        };
    }
}

I'm using U2.Data.Client version 2.1.0.2051

Any thoughts or ideas would be very appreciated. Thanks.


Solution

  • Thank you for asking this question. Make sure database ‘/data/TSAA’ is listed in two places.

    1. ud_database (see screen shot) (in windows, C:\U2\ud73\INCLUDE\ud_database)
    2. UD.ACCOUNT (see screen shot) a. Logto ‘sys’ account b. LIST UD.ACCOUNT c. Make sure you have ‘/data/TSAA’ entry there.

    We will fix this issue in V 2.2.0 so that you do not need to do the above said extra steps.

    This issue is resolved in U2 Toolkit for .NET v2.2.0 (BETA). Read this for more information.

    Async\Await and Entity Framework 6.1 in Rocket MV U2 Toolkit for .NET v2.2.0 (BETA)

    enter image description here

    enter image description here