I’m getting the following exception when trying to run the following code.
Is there a way to enable or set the HTTP Header X-Trino-User?
PrestoConnection connection = new PrestoConnection($"Server={_configuration["TrinoServerIP"]};Port={_configuration["TrinoServerPort"]};");connection.Open();string sql = "SELECT * FROM hive.default.customer";PrestoCommand cmd = new PrestoCommand(sql, connection);PrestoDataReader rdr = cmd.ExecuteReader();while (rdr.Read()){ Console.WriteLine(String.Format("\t{0} --> \t\t{1}", rdr["Id"], rdr["Name"]));}
PrestoAdo Source: TrinoClientTests.cs line 91 Duration: 1.4 sec Message: Test method Juniper.Test.Trino.TrinoClientTests.PrestoAdo threw exception: System.Data.CData.Presto.PrestoException: [500] Could not execute the specified command: HTTP protocol error. 401 Basic authentication or X-Trino-User must be sent. ---> oro230j.TC: HTTP protocol error. 401 Basic authentication or X-Trino-User must be sent. Stack Trace: LdJ.j(Lax[] , Int32 , Int32 )LdJ.n()RUC.Nd()RUx.Nd()RTG.a(RUx )RTN.FJ()RTG.NS()KJ.U(SQLQuery , Int32 , RRq )KJ.d(IDataStatement , SQLQuery , QueryParameterCollection , Int32 , String , LeW )RUJ.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )RUG.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )LTx.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )ZW.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )yN.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )RIe.FW()RIh.dd()SF.pg(QueryParameterCollection )PrestoCommand.ExecuteDataReader(CommandBehavior behavior)--- End of inner exception stack trace ---PrestoCommand.ExecuteDataReader(CommandBehavior behavior)PrestoCommand.ExecuteDbDataReader(CommandBehavior behavior)PrestoCommand.ExecuteReader()<PrestoAdo>d__5.MoveNext() line 104--- End of stack trace from previous location where exception was thrown ---ExceptionDispatchInfo.Throw()TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)ThreadOperations.ExecuteWithAbortSafety(Action action)