5

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.

Dan McGrath
  • 41,220
  • 11
  • 99
  • 130
user1757494
  • 101
  • 4

2 Answers2

2

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.

Dan McGrath
  • 41,220
  • 11
  • 99
  • 130
  • so even though I can access the data via ODBC from SQL Server - it doesn't mean that CONVERT.SQL has been run? – user1757494 Oct 19 '12 at 17:12
  • Is this issue resolved? Could you please try specifying column names instead of *. For Example : SELECT COL1 FROM THENAME; – Rajan Kumar Dec 20 '13 at 21:35
0

Could you please run TCL command ?

select * from privilege;

Do you see THENAME there? For example, see enclosed screen shot for VOC file.

enter image description here

enter image description here

Rajan Kumar
  • 718
  • 1
  • 4
  • 9