All Forums Connectivity
JoeL 312 5 posts Joined 11/11
07 Jun 2012
.Net Connection String with LDAP

Trying to connect through C# using an LDAP login:

 Teradata.Client.Provider.TdConnection con =
                    new Teradata.Client.Provider.TdConnection("Data Source=;User ID=mw;Password=pwd;");


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
       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()

NetFx 346 posts Joined 09/06
07 Jun 2012


Use TdConnectionStringBuilder class to build the Connection String; set TdConnectionStringBuilder.AuthenticationMechanism to LDAP. 

Data Source=;User ID=mw;Password=pwd; Authentication Mechanism=LDAP;

flash7gordon 29 posts Joined 05/10
20 Mar 2013

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 = "";

                    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),









flash7gordon 29 posts Joined 05/10
21 Mar 2013

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;Password=mypw

flash7gordon 29 posts Joined 05/10
26 Feb 2014

After you install the teradata client on your visual studio 2010 development machine, I "Reference", "Add", "Browse" Tab to this location to add the Teradata.Client.Provider using to the program:
C:\Program Files (x86)\Teradata\NET Data Provider for Teradata\13.11.00\bin\Teradata.Client.Provider.dll
Your's might be slightly different since most people are using the teradata 14.x client now.

You must sign in to leave a comment.