0
votes

I'm trying to connect using the string connection below, but with errors.

using (TdConnection cn = 
new TdConnection(@"Data Source=ip;
    User ID=myuser;
    Password=$tdwallet(mytdwallet);
    Authentication Mechanism=ldap;"))

I'm able to conect like that,works :

using(TdConnection cn = 
new TdConnection(@"Data Source=ip;
    User ID=myuser;
    Password=mypass;
    Authentication Mechanism=LDAP;"))

But the Problem is I'dont wann put my password in the code,somebody knows some solutions to this problem?

InnerException {Teradata.Net.Security.TdgssException: TdgssAuthenticationTokenExchange delegate threw an exception. See the inner exception for details. ErrorCode: -2146233088 Severity: Warning Facility: LoadTdgss ---> Teradata.Client.Provider.TdException: [Teradata Database] [8017] The UserId, Password or Account is invalid. at Teradata.Client.Provider.WpMessageManager.CheckForError(Request request) at Teradata.Client.Provider.WpSecurityManager.GetSsoResponseToken() at Teradata.Net.Security.Mechanisms.ldapSession.AuthenticateAsClientImplementation(TdgssAuthenticationTokenExchange tokenAuthenticationExchange, String credential, String targetName)
--- End of inner exception stack trace --- at Teradata.Net.Security.Mechanisms.ldapSession.AuthenticateAsClientImplementation(TdgssAuthenticationTokenExchange tokenAuthenticationExchange, String credential, String targetName)
at Teradata.Net.Security.Mechanisms.Session.AuthenticateAsClient(TdgssAuthenticationTokenExchange tokenAuthenticationExchange, String credential, String targetName)
at Teradata.Client.Provider.WpSecurityManager.Action()} System.Exception {Teradata.Net.Security.TdgssException}

1

1 Answers

0
votes

In your project exists a configuration file (it call "App.config"), you should add:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="ConnectionTeradata" providerName="Teradata" connectionString="Data Source=ip;User ID=myuser;Password=mypass;Authentication Mechanism=LDAP;" />
  </connectionStrings>
</configuration> 

And then in your file code, you can use:

ConfigurationManager.ConnectionStrings["ConnectionTeradata"]?.ConnectionString