All Forums Connectivity
cqash 7 posts Joined 01/07
08 Jan 2007
.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(UtlConnection String connectionString, UInt32 timeout) +496 Teradata.Client.Provider.ConnectionPool.CreateConnecti on(UInt32 timeout) +42 Teradata.Client.Provider.ConnectionPool.GetConnectionF romPool(Object owningObject) +317 Teradata.Client.Provider.ConnectionFactory.GetConnecti on(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(St ring eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBa ckEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHa ndler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollect ion postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102Version 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 = "FehlerBitte wählen Sie eine Datei aus."; return; } else { if (".txt" != ext) { txtOutput.InnerHtml = "FehlerDie gewählte Datei ist keine Text-Datei."; return; } else { 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;"); myCon.Open(); 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"); cmd.ExecuteScalar(); while (null != (strLine = stmReader.ReadLine())) { daten++; 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)) { fehler++; } else { cmd.CommandText = String.Format("insert into dbt_qss_stage.b2c_imp (ekp_no) VALUES (" + strLine + ")"); cmd.ExecuteNonQuery(); ok++; } } tran.Commit(); tran.Dispose(); tran = null; cmd.Dispose(); myCon.Close(); txtOutput.InnerHtml = "HinweisDie Daten wurden erfolgreich in die Datenbank eingepflegt.Anzahl Datensätze: " + daten + "Eingefügte Datensätze: " + ok + "Anzahl Fehler: " + fehler + ""; } else { txtOutput.InnerHtml = "FehlerDie Datei konnte nicht übertragen werden."; return; } } } } }}------------- source default.aspx.cs -------------THX for helpyour cqash

marcmc 112 posts Joined 12/05
08 Jan 2007

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?

cqash 7 posts Joined 01/07
08 Jan 2007

Hi,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 RAMIf I start the task-manager, I can see under "performance" two CPU windows. So I think, the serveris 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 helpCU cqash

marcmc 112 posts Joined 12/05
09 Jan 2007

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.http://www.c-sharpcorner.com/Code/2002/Sept/ODBCDataProvider1.asp-- codeDim 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;" TDStrSQL = "SELECT NAME FROM DEV_DATA_V.TABLE1 WHERE NAME = '" + TextBox1.Text + "';" TDODBCcn = New OdbcConnection(TDODBCcnString) TDODBCcn.Open() TDODBCcmdSelect = New OdbcCommand(TDStrSQL, TDODBCcn) MessageBox.Show(TDODBCcn.State.ToString) TDODBCdtr = TDODBCcmdSelect.ExecuteReader If TDODBCdtr.Read() Then If Not TDODBCdtr.IsDBNull(0) Then TextBox2.Text = TDODBCdtr.GetString(0) End If End If TDODBCdtr.Close() TDODBCcn.Close()--

marcmc 112 posts Joined 12/05
09 Jan 2007

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 + "';" Try cn = pf.CreateConnection cn.ConnectionString = cnString cn.Open() 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 stuffend if end if

NetFx 346 posts Joined 09/06
09 Jan 2007

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. 100.12.30.99) 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.

cqash 7 posts Joined 01/07
09 Jan 2007

Hi,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.and...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

NetFx 346 posts Joined 09/06
09 Jan 2007

>>>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.

cqash 7 posts Joined 01/07
10 Jan 2007

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 ...www.megaupload.com/?d=5QE6SIF3

Fred 1096 posts Joined 08/04
10 Jan 2007

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.

marcmc 112 posts Joined 12/05
10 Jan 2007

Hey Fred. Whether ODBC or Teradata.Client.Provider, would that make any difference to the deployment on the aspx server though even after initial deployment on desktop worked?

cqash 7 posts Joined 01/07
10 Jan 2007

I don't know why the terada don't show my post in Web.config and default.aspx, if I edit my post, I can see, but it isn't shown online.No the User and password ist safed in the ODBC-Connection DSN.I have tastet both version from .NET Data Provider for Teradat, noone is working on the Server.

cqash 7 posts Joined 01/07
10 Jan 2007

I know that the UserID and Password must be in "". I tried, but it does't work.You can download the sourcefiles here ... http://www.megaupload.com/?d=5QE6SIF3The site is only for intranet working use.Thank you all for help and tipps.Cu cqash

You must sign in to leave a comment.