July 9, 2013 at 1:18 am
Hi,
we have developed a .NET method which we have incorportaed in SQL Server as an assembley, and wrapped it in a stored procedure. NOTE.. The method has a try.. catch which raises the exception. The stored procedure wrapper also has a try catch which returns the error in a controlled fashion.
The .NET method interacts with an IBM AS400 database using ODBC.
On the server we have an instance of SQL 2008 R2 and SQL 2005. When we call the assembley from SQL 2005 it works, however, when we run from the SQL 2008 R2 instance, it hangs, and never returns.
We have tried the same thing on other servers which have SQL 2008 R2 installed, and they work.
From this I would conclude that it is something to do with the implementation of SQL Server 2008 R2 on the server.
Has anyone experienced any similar issues to this, or does anyione have any idea of what may be causing the process to hang? Below is a copy of the .NET code...
/***********************************************************************************************\
* Class name: ExecuteNonQuery
* Author: Neil Bryan
* Date: 2013-07-03
* Description: CLR functionality for executing an update, delete or insert on the DBS
* system from SQL Server. Note: Connection details are hard coded.
* Amendment History:
*
* Who Date Ref Description
* --- ---- --- -----------
* Neil Bryan 2013-07-03 Created.
\***********************************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Odbc;
using Microsoft.SqlServer.Server;
namespace DBS_CLR
{
public class FunctionLibrary
{
public static void ExecuteNonQuery(string sql)
{
OdbcConnection conn = new OdbcConnection();
OdbcCommand myOdbcCommand = new OdbcCommand(sql);
conn.ConnectionTimeout = 10;
myOdbcCommand.Connection = conn;
conn.ConnectionString = "Dsn=dsnname;uid=uname;pwd=pword";
try
{
conn.Open();
myOdbcCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myOdbcCommand.Connection.Close();
conn.Close();
}
}
}
}
many thanks,
Neil
August 21, 2013 at 1:16 pm
I assume you have tested the ODBC connection manually with the ODBC applet? Make sure that the service account that the instance is running as has permission on the DSN you created.
The probability of survival is inversely proportional to the angle of arrival.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply