Monday, December 9, 2013

How to use Teradata with .NET

I recently worked on a fairly complex report which pulled data from three different systems.  One of the databases used Teradata.

How to use Teradata with .NET


1.  Download the .NET driver:
 http://downloads.teradata.com/download/connectivity/net-data-provider-for-teradata

2.  Add a reference to both  Teradata.Client.Provider.dll and the Teradata.Net.Security.Tdgss.dll in your Visual Studio Project

3.  Create a connection string in the web or app.config.  Here is the format:
http://www.connectionstrings.com/teradata/

  


4.  Write some code to connect.
Example:

using Teradata.Client.Provider;

public class Repository
{
    public void TestConnection()
    {
        TdConnection conn = new TdConnection
        {
            ConnectionString = ConfigurationManager.ConnectionStrings["MyDatabase"].ToString()
        };
        conn.Open();
    }
}


Questions

Q:  In order to use Teradata with .NET, do I need to do a full install of the drivers on the web server or do I just need Teradata.Client.Provider.dll and the Teradata.Net.Security.Tdgss.dll?

A:  I found this out by trial.  The Teradata driver does not reference any unmanaged pieces so it can be xcopy deployed to the bin directory on your web server.




Q:  Why am I getting the error:  [Teradata Database] [8017] The UserId, Password or Account is invalid.
A:  Put this in your web.config: 

 


Q:  When am I getting this error:  The NTLM authentication token is not supported
A:  I don't know why.  I had to switch from integrated security to a normal user name and password.

No comments: