Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing UniData through .net

I'm having trouble with accessing UniData data from the u2.net toolkit. I'm able to connect ok - have tested connections with the "Test Connection Tool" and in code, both connections work fine. My problem is when I try and fill a dataset - using the sample code: I get this error:

[U2][UCINET][UNIDATA]:You have no privilege on file THENAME

Here is the code:

           U2Connection con = new U2Connection();
        try
        {
            U2ConnectionStringBuilder conn_str = new U2ConnectionStringBuilder();
            conn_str.UserID = "id";
            conn_str.Password = "pwd";
            conn_str.Server = "srv2";
            conn_str.Database = "DB.XXX";
            conn_str.ServerType = "UNIDATA";
            conn_str.RpcServiceType = "udserver";


            con.ConnectionString = conn_str.ToString();
            con.Open();
            DataTable schema = con.GetSchema();
            U2DataAdapter da = new U2DataAdapter("SELECT * FROM THENAME ", con);
            DataSet ds = new DataSet();
            da.Fill(ds);
        }
        catch (Exception ex)
        {
            string lStr = ex.Message;
        }
        finally
        {
            con.Close(); 

1 more note, I have an ODBC connection setup. Through ODBC I can use the same credentials inside a SQL Server Linked Server to access the same query successfully. Any Ideas would be appreciated.

like image 900
user1757494 Avatar asked Nov 03 '22 13:11

user1757494


1 Answers

By default, UniData grants no privileges to access files via SQL.

You will need to run CONVERT.SQL from the database to grant privileges to the file.

You can find out more about the command by either running HELP CONVERT.SQL on the command line, or reading the manuals.

like image 73
Dan McGrath Avatar answered Nov 11 '22 06:11

Dan McGrath