Use TdConnectionStringBuilder class to build the Connection String; set TdConnectionStringBuilder.AuthenticationMechanism to LDAP.
Data Source=192.168.1.54;User ID=mw;Password=pwd; Authentication Mechanism=LDAP;
I got a working teradata ldap connection to work with c# with the following:
-
// below has to be downloaded and "References"d in the project
using Teradata.Client.Provider;
using (TdConnection cn = new TdConnection())
{
TdConnectionStringBuilder conStrBuilder = new TdConnectionStringBuilder();
// i got the server from the ldap odbc description of the connection
conStrBuilder.DataSource = "tdserver.com";
conStrBuilder.Database = "mydb";
conStrBuilder.UserId = "myuid";
conStrBuilder.Password = "mypw";
conStrBuilder.AuthenticationMechanism = "LDAP";
Console.WriteLine("conn string was: " + conStrBuilder.ConnectionString);
cn.ConnectionString = conStrBuilder.ConnectionString; cn.Open();
TdCommand cmd = cn.CreateCommand();
cmd.CommandText = "select top 100 * from mydb.mytable";
TdDataReader reader = cmd.ExecuteReader();
Console.WriteLine("{0} records affected.", reader.RecordsAffected);
int currentRow = 1;
while (reader.Read())
{
for (int columnIndex = 0; columnIndex < reader.FieldCount; columnIndex++)
{
// this is pretty cool. Does every field with it's name.
Console.WriteLine("Row [{0,4}] [{1,20}] = {2}",
currentRow, reader.GetName(columnIndex),
reader.GetValue(columnIndex));
}
Console.WriteLine();
currentRow++;
}
The above was accomplished with the TD Plugin 14.1 and VS 2010. Here is the connection string that worked (I obviously can't show our real organizational values) conn string was: Database=mydb;Authentication Mechanism=LDAP;User Id=myuid;Data
Source=tdserver.com;Password=mypw


Trying to connect through C# using an LDAP login:
Teradata.Client.Provider.TdConnection con =
new Teradata.Client.Provider.TdConnection("Data Source=192.168.1.54;User ID=mw;Password=pwd;");
con.Open();
Note I can log in with SQL Assistant with this server, user id, and password (so I think that's not the problem).
Also, if I use teradata auth, it this connection string works.
Error received (emphasis added is mine):
Teradata.Client.Provider.TdException was unhandled
Message=[Teradata Database] [8017] The UserId, Password or Account is invalid.
Source=Teradata Database
ErrorCode=-2147467259
TxRolledBack=true
StackTrace:
at Teradata.Client.Provider.WpMessageManager.CheckForErro r()
at Teradata.Client.Provider.WpMessageManager.ProcessRespo nse()
at Teradata.Client.Provider.WpLogonManager.Action()
at Teradata.Client.Provider.WpSession.ManagerAction(WpMes sageManager manager, Stopwatch watch, Int32 connectionTimeout)
at Teradata.Client.Provider.WpSession.Open(Int32 connectionTimeout, String password)
at Teradata.Client.Provider.Connection.Open(UtlConnection String connectionString, UInt32 timeout)
at Teradata.Client.Provider.ConnectionPool.CreateConnecti on(UInt32 timeout)
at Teradata.Client.Provider.ConnectionPool.GetConnectionF romPool(Object owningObject)
at Teradata.Client.Provider.ConnectionFactory.GetConnecti on(Object owningObject, UtlConnectionString connStr)
at Teradata.Client.Provider.TdConnection.Open()
at CodeEditor.CodeEditor.FileOpen_Click(Object sender, EventArgs e) in C:\BegASPNET\CodeEditor\CodeEditor\CodeEditor.cs:line 24
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMes sage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndPr oc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(I ntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessa geW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.Syst em.Windows.Forms.UnsafeNativeMethods.IMsoComponentMana ger.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMess ageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMess ageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at CodeEditor.Program.Main() in C:\BegASPNET\CodeEditor\CodeEditor\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUser sAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Obje ct state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: