.Net Data Provider for Tearadata connection problem


.Net Data Provider for Tearadata connection problem

Hi @all,

at fist sorry for my bad english.

I have a web site in aspx C# with a teradata connection. I developed the site on "Windows XP Sp2" with "Framework 1.1 and 2.0" an the ".Net Data Provider for Tearadata 01.01.0000" on IIS 5.1 AND all works fine.

Then I publish the website on the Serversystem "Windows Server 2003" with all updates und "Framework 1.1 and 2.0" and the ".Net Data Provider for Tearadata 01.01.0000". If I go on the site, I get the following errormessage ...

Server Error in '/upload' Application.

[Call-Level Interface, Version 2] [303] CLI2: BADLOGON(303): Invalid logon string.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Teradata.Client.Provider.TdException: [Call-Level Interface, Version 2] [303] CLI2: BADLOGON(303): Invalid logon string.


Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[TdException (0x80004005): [Call-Level Interface, Version 2] [303] CLI2: BADLOGON(303): Invalid logon string.
Teradata.Client.Provider.WpSession.Connect(Int32 timeout) +555
Teradata.Client.Provider.Connection.Open(UtlConnectionString connectionString, UInt32 timeout) +496
Teradata.Client.Provider.ConnectionPool.CreateConnection(UInt32 timeout) +42
Teradata.Client.Provider.ConnectionPool.GetConnectionFromPool(Object owningObject) +317
Teradata.Client.Provider.ConnectionFactory.GetConnection(Object owningObject, UtlConnectionString connStr) +567
Teradata.Client.Provider.TdConnection.Open() +363
_Default.Button1_Click(Object sender, EventArgs e) +594
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42


But the passwort and username are correct, because the site works from my system. Here my source ...

------------- source default.aspx.cs -------------
using System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Teradata.Client.Provider;
using System.Text.RegularExpressions;

public partial class _Default : System.Web.UI.Page
public void Page_Load(object sender, EventArgs e)


public void Button1_Click(object sender, EventArgs e)
// ---------------------------- Speicherpfad notfalls anpassen. ----------------------------
string strBaseLocation = @"H:\apps\upload\files\";
// ---------------------------- Speicherpfad notfalls anpassen. ----------------------------
string jahr = String.Format("{0:yyyy}", DateTime.Now);
string monat = String.Format("{0:MM}", DateTime.Now);
string tag = String.Format("{0:dd}", DateTime.Now);
string datum = jahr + "-" + monat + "-" + tag;
string strFileNameOnServer = datum + ".txt";
string pfad = FileUpload1.FileName;
string ext = Path.GetExtension(pfad);

if ("" == pfad)
txtOutput.InnerHtml = "

Bitte wählen Sie eine Datei aus.

if (".txt" != ext)
txtOutput.InnerHtml = "

Die gewählte Datei ist keine Text-Datei.

if (null != FileUpload1.PostedFile)
FileUpload1.PostedFile.SaveAs(strBaseLocation + strFileNameOnServer);

if (File.Exists(strBaseLocation + strFileNameOnServer))
TdTransaction tran = null;
TdConnection myCon = new TdConnection("Data Source=IP-adress;User Id=usernamew;Password=password;");

tran = myCon.BeginTransaction();
TdCommand cmd = myCon.CreateCommand();
cmd.Transaction = tran;
string strLine;
int daten = 0;
int ok = 0;
int fehler = 0;
StreamReader stmReader = File.OpenText(strBaseLocation + strFileNameOnServer);
cmd.CommandText = String.Format("delete from dbt_qss_stage.b2c_imp");

while (null != (strLine = stmReader.ReadLine()))
strLine = strLine.Replace("^\t", "");
strLine = strLine.Replace("^\n", "");
strLine = strLine.Replace("^\r", "");
strLine = strLine.Replace("\t$", "");
strLine = strLine.Replace("\n$", "");
strLine = strLine.Replace("\r$", "");

Regex r = new Regex("[^0-9]");
if (r.IsMatch(strLine))
cmd.CommandText = String.Format("insert into dbt_qss_stage.b2c_imp (ekp_no) VALUES (" + strLine + ")");
tran = null;
txtOutput.InnerHtml = "

Die Daten wurden erfolgreich in die Datenbank eingepflegt.

Anzahl Datensätze: " + daten + "
Eingefügte Datensätze: " + ok + "
Anzahl Fehler: " + fehler + "

txtOutput.InnerHtml = "

Die Datei konnte nicht übertragen werden.


------------- source default.aspx.cs -------------

THX for help
your cqash

Re: .Net Data Provider for Tearadata connection problem

It's a very longshot but does your server run on a different type of processor than your desktop.
If so, it might help to decide which .net framework 2.0 redistributable package you require. x64 or x86?

Re: .Net Data Provider for Tearadata connection problem


On the server is the Framework x86 installed (I Stink). I don't have admin-access on the system.
I must phone with the support, and then they config or install the software or driver.

The Server:
Intel Xeon CPU with 3.00 GHz, 4GB RAM

If I start the task-manager, I can see under "performance" two CPU windows. So I think, the server
is a DUAL-CORE-Machine.

The support have update "Windows 2003" with all updates and Framework 1.1, 2.0 with all updates.
They have deinstall the .NET Data Provider for Teradata and new install them. Nothing help.

I cant't access the database through the aspx-site, when it run on the server.

Have anyone an idea or tipp for me. Thx for help

CU cqash

Re: .Net Data Provider for Tearadata connection problem

I am currently migrating a .NET application from VS 2003 V7.0 and from SQLServer to Teradata.
Today I will be testing the new connection strings and Teradata.Client.Provider objects so I will let you know how I get on and what my code is. I will understand it all a bit better when I get my connections working.

Meanwhile, have you tried using a test application with one button using Microsoft.odbc.dll?
If you can deploy an application using odbc on your desktop and then it doesn't work on the server you can rule out that your code is a problem and let the operations guys sort the server out.

If you have an interest in testing this, here are the guidelines for installing odbc objects and some code that will make it work.


-- code
Dim TDODBCcn As OdbcConnection
Dim TDODBCcmdSelect As New OdbcCommand
Dim TDODBCdtr As OdbcDataReader
Dim TDODBCcnString As String
Dim TDStrSQL As String

'ODBC Driver for Teradata - connection string
TDODBCcnString = "DSN=" & ServerLogXML & ";UID=" & UNameLogXML & ";Pwd=" & PasswordLogXML
'TDODBCcnString = "DSN=servername;UID=udername;Pwd=password;"

TDODBCcn = New OdbcConnection(TDODBCcnString)
TDODBCcmdSelect = New OdbcCommand(TDStrSQL, TDODBCcn)
TDODBCdtr = TDODBCcmdSelect.ExecuteReader

If TDODBCdtr.Read() Then
If Not TDODBCdtr.IsDBNull(0) Then
TextBox2.Text = TDODBCdtr.GetString(0)
End If
End If


Re: .Net Data Provider for Tearadata connection problem

this is what i used for my windows app in vb.net. Hope this helps. I'm not sure what the server problem you are experiencung is though, sorry.

'.NET Data Provider for Teradata - Teradata.Client.Provider
Dim cn As DbConnection
Dim cmd As DbCommand 'New?
Dim dtr As DbDataReader
Dim strSQL As String
Dim cmdSelect As DbCommand
Dim cnString As String
Dim pf As DbProviderFactory = DbProviderFactories.GetFactory("Teradata.Client.Provider")

cnString = "Data Source=" & ServerLogXML & ";User ID=" & UNameLogXML & ";Password=" + PasswordLogXML
strSQL = "SELECT uname FROM DEV_DATA_V.mis_MISRE_employees WHERE uname = '" + txtUName.Text + "';"

cn = pf.CreateConnection
cn.ConnectionString = cnString
Catch ex As Exception
sbLogin.Text = ("Error: Could not establish database connection")
End Try

cmd = pf.CreateCommand
cmd.Connection = cn
cmd.CommandText = strSQL
cmd.CommandType = CommandType.Text
dtr = cmd.ExecuteReader

If dtr.Read() Then
If Not dtr.IsDBNull(0) Then
UName = dtr.GetString(0)
....do stuff
end if
end if

Teradata Employee

Re: .Net Data Provider for Tearadata connection problem

Do you use the same Connection String in the development environment and in production (Server)?

I saw the following line:
TdConnection myCon = new TdConnection(
"Data Source=IP-adress;User Id=usernamew;Password=password;");

Are you specifying an IP Address (e.g. or TDPID (System name)?

I think the Data Source must not be a valid TDPID name. TDPID has to be 8 characters or less. .NET Data Provider ships with an Ad-Hoc query tool called NQuery (Samples\Bin Directory). You can use NQuery to experiment with Connection Strings.


Re: .Net Data Provider for Tearadata connection problem


yes, I taste it with IP and Hostname, but the hostname have more than 8 charcters (22 with domain). I try a connection with NQuery and it works, but I cant't use ConnectionString, because I get on other error message.

yes, the ASPX-site only run on my local IIS, but the file will be safe on the server und the data will be insert into the database on the server.

But I have faint hope that it will work. Tomorrow I try a connection with ODBC, it's a little bit slower, but I think, it will work.

Thanks for your help and interess.

I publish my sourcecode, if it works.

Cu cqash
Teradata Employee

Re: .Net Data Provider for Tearadata connection problem

>>>yes, I taste it with IP and Hostname, but the hostname have more than 8 charcters
>>>(22 with domain).

Let me see if I understand this correctly. You are using the same exact connection string with IP-Address while debugging your application and when you deploy the application to IIS on your workstation. Is this correct?

>>>I try a connection with NQuery and it works, but I cant't use ConnectionString,
>>>because I get on other error message.

I dont follow. Please clarify.


Re: .Net Data Provider for Tearadata connection problem

Hi @all,

now it's working, but only over ODBC.
I hope this help other user in the future.

Thanks for your help. cqash

****, I can't publish my sourcecode, because the teradata-forum use the code as it own.

You can download the files here ...

Teradata Employee

Re: .Net Data Provider for Tearadata connection problem

Is the working ODBC application getting User ID and Password from the DSN, or is it actually in the connection string and just not shown here for security reasons?

If the Password (or User ID) contains special characters, the value must be enclosed in quotes (Password="..." ;-) within the connection string passed to the driver.