Problem executing .net batch program from server

Connectivity

Problem executing .net batch program from server

Hi - I'm new to posting to forums.  I'll do my best to describe my problem.

I have a .net console application that runs on a Windows platform.  The console app executes and then attempts to write logging information to a table in a Teradata database.  The console app exectues a stored procedure to write to either a BatchResults table if successful for a BatchErrors table if there were any errors.

The console app runs correctly on my desktop.  When deployed to a Windows server the console app fails.  The stack trace is below.

I have the Teradata.Client.Provider.dll in the \bin directory.  I saw another posting about updating the .config file with the following:

<system.data>

 <DbProviderFactories>

  <add name=".NET Data Provider for Teradata" invariant="Teradata.Client.Provider" description=".NET Framework Data Provider for Teradata" type="Teradata.Client.Provider.TdFactory, Teradata.Client.Provider, Version=12.0.1.0, Culture=neutral, PublicKeyToken=76b417ee2e04956c" />

 </DbProviderFactories>

</system.data>

I added this and nothing changed.

My connect string is

  <add name="dbRCMAppsConnection" connectionString="User Id=name;Data Source=10.100.203.1;Password=pswd;" providerName="Teradata.Client.Provider" />

What else might I be missing?  Thanks.

Below is the stack trace:

20120112Error writing to Batch_Error_Log table.

Message: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Stack-Error:    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity)

   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)

   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)

   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)

   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)

   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)

   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)

   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)

   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)

   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)

   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

   at System.Data.SqlClient.SqlConnection.Open()

   at BatchCommonFunctions.LoggingClass.LogError(Int32 ProcessId, String ProcessName, DateTime BusinessDate, Exception Ex, Int32 exitCode, String strConnection, String strLogFileName)

20120112Error writing to Batch_Error_Log table.

Message: The type initializer for 'Teradata.Client.Provider.WpSession' threw an exception.

Stack-Error:    at Teradata.Client.Provider.WpSession.get_ObjectId()

   at Teradata.Client.Provider.WpSession..ctor(UtlConnectionString connectionString)

   at Teradata.Client.Provider.Connection.Open(UtlConnectionString connectionString, UInt32 timeout)

   at Teradata.Client.Provider.ConnectionPool.CreateConnection(UInt32 timeout)

   at Teradata.Client.Provider.ConnectionPool.GetConnectionFromPool(Object owningObject)

   at Teradata.Client.Provider.ConnectionFactory.GetConnection(Object owningObject, UtlConnectionString connStr)

   at Teradata.Client.Provider.TdConnection.Open()

   at BatchCommonFunctions.LoggingClass.LogErrorOnTeradata(Int32 ProcessId, String ProcessName, DateTime BusinessDate, Exception Ex, Int32 exitCode, String strConnection, String strLogFileName)

4 REPLIES

Re: Problem executing .net batch program from server

Some improvement -

1.  The code was referencing a database where the stored procedure hadn't yet been created - my error.

2.  I got past a timeout issue by adding the "Connection Timeout=90" to the connect string.

Now I'm struggling with a error that looks like port 1025 isn't available.  Is that what the following message means?

[.NET Data Provider for Teradata] [115025] Could not resolve Data Source=IDW to an available node after 2 attempts.

[Socket Transport] [10060] System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.100.203.4:1025

Teradata Employee

Re: Problem executing .net batch program from server

Most likely the "Data Source" (i.e. IDW) is not correct.

Is th IP Address (i.e. 10.100.203.4) correct?  You said that it worked on your desktop. You can establish a connection from your desktop and use NetStat to see the remote IP-Address and the Port number. Of course I assume that the desktop and the server use the same DNS settings.

Re: Problem executing .net batch program from server

The console app works from other servers.  We're trying to figure out why this particular server won't connect.  Port #?  Server segmentation?  Any suggestions?  Thanks.

Re: Problem executing .net batch program from server

This was resolved.  The server in production wasn't listening to port 1025.  NSLOOKUP to our Teradata platform worked.  telnet to our Teradata platform and transmitting any character string did not work.

The test was

Can you do the following…

From the cmd prompt…

telnet xxx.xxx.xxx.xxx 1025

press enter

a telnet session is opened and just type  some random characters…

it should fail with a error…like below..

   The LAN message Format field is invalid.

We didn't get this message.  Instead we got a message that read

Could not open the connection to host, on port 1025:  Connect failed.