Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

CLR ODBC Call Hangs Expand / Collapse
Posted Tuesday, July 9, 2013 1:18 AM


Group: General Forum Members
Last Login: Monday, October 24, 2016 4:15 AM
Points: 13, Visits: 324

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";
catch (Exception ex)
throw (ex);


many thanks,

Post #1471455
Posted Wednesday, August 21, 2013 1:16 PM

UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Wednesday, October 19, 2016 12:41 PM
Points: 1,447, Visits: 3,254
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.
Post #1486888
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse