Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

ADODB call error "Invalid URI: The URI is empty" Expand / Collapse
Author
Message
Posted Monday, May 18, 2009 3:24 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, August 21, 2014 4:21 PM
Points: 12, Visits: 78
I built a simple method sending an ADODB recordset via MSMQ and successfully tested in a console app, but when I import into sql server2005 CLR and exectue I get an error.

-- Send object (all code works except this line):

[SqlProcedure]
public static void Send(SqlString queue, SqlString point, SqlString bodynumber, out SqlString msg)
{
ADODB.Recordset rs = new ADODB.Recordset(); - call causing error

} // end Send

-- sql code
create assembly SqlMSMQtools authorization dbo from 'C:\temp\SqlMSMQtools.dll' with permission_set = unsafe
go


-- proc
create PROCEDURE usp_MSMQ_SendAP46
@queue nvarchar(500),
@point nvarchar(100),
@body_number nvarchar(10),
@msg nvarchar(MAX) output
AS EXTERNAL NAME SqlMSMQtools.[SqlMSMQtools.Basic].Send
GO

-- execute
DECLARE @test nvarchar(1024)
EXEC usp_MSMQ_SendAP46 @queue='FormatName:DIRECT=TCP:1.2.3.4\\private$\\XXX', @point='TestPoint',@body_number='123456', @msg = @test OUTPUT
select @test

-- error
Msg 6522, Level 16, State 1, Procedure usp_MSMQ_SendAP46, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'usp_MSMQ_SendAP46':
System.UriFormatException: Invalid URI: The URI is empty.
System.UriFormatException:
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.ComponentModel.Design.RuntimeLicenseContext.GetLocalPath(String fileName)
at System.ComponentModel.Design.RuntimeLicenseContext.GetSavedLicenseKey(Type type, Assembly resourceAssembly)
at System.ComponentModel.LicenseManager.LicenseInteropHelper.GetCurrentContextInfo(Int32& fDesignTime, IntPtr& bstrKey, RuntimeTypeHandle rth)
at SqlMSMQtools.Basic.Send(SqlString queue, SqlString point, SqlString bodynumber, SqlString& msg)
Post #719450
Posted Tuesday, May 19, 2009 8:47 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Sunday, November 4, 2012 12:23 PM
Points: 1,893, Visits: 3,932
Hi

Question:
Why do you use ADODB instead of ADO.NET?

Could you please wrap your code with the following exception handler and post the result. Maybe this helps to find the problem:
[code="csharp"]
try
{
////////////////////////////////////////
// YOUR CODE
int i = int.Parse("blah");
////////////////////////////////////////
}
catch (Exception ex)
{
System.IO.StringWriter sw = new System.IO.StringWriter();

sw.WriteLine("======================================");
sw.WriteLine("Exception");
sw.WriteLine("Type: {0}", ex.GetType());
sw.WriteLine("Message: {0}", ex.Message);

Exception e = ex.InnerException;
while (e != null)
{
sw.WriteLine();
sw.WriteLine("-------------------------");
sw.WriteLine("Inner Exception");
sw.WriteLine("Type: {0}", e.GetType());
sw.WriteLine("Message: {1}", e.Message);

e = e.InnerException;
}

System.Diagnostics.StackTrace stack;

stack = new System.Diagnostics.StackTrace(ex, true);
sw.WriteLine();
sw.WriteLine("-------------------------");
sw.WriteLine("Target");
for (int i = stack.FrameCount - 1; i >= 0; i--)
{
System.Diagnostics.StackFrame frame = stack.GetFrame(i);
sw.WriteLine("({0}) :: {1} | File(Line:Column): {2} ({3}:{4})",
(frame.GetMethod().DeclaringType == null ? "<UNKNOWN>" : frame.GetMethod().DeclaringType.ToString()),
frame.GetMethod().ToString(),
string.IsNullOrEmpty(frame.GetFileName()) ? "<UNKNOWN>" : frame.GetFileName(),
frame.GetFileLineNumber(),
frame.GetFileColumnNumber());
}


stack = new System.Diagnostics.StackTrace(1, true);
sw.WriteLine();
sw.WriteLine("-------------------------");
sw.WriteLine("Origin");
for (int i = 0; i < stack.FrameCount; i++)
{
System.Diagnostics.StackFrame frame = stack.GetFrame(i);
sw.WriteLine("({0}) :: {1} | File(Line:Column): {2} ({3}:{4})",
(frame.GetMethod().DeclaringType == null ? "<UNKNOWN>" : frame.GetMethod().DeclaringType.ToString()),
frame.GetMethod().ToString(),
string.IsNullOrEmpty(frame.GetFileName()) ? "<UNKNOWN>" : frame.GetFileName(),
frame.GetFileLineNumber(),
frame.GetFileColumnNumber());
}

SqlContext.Pipe.Send(sw.GetStringBuilder().ToString());
}
[/code]

Thanks
Flo



The more I learn, the more I know what I do not know
Blog: Things about Software Architecture, .NET development and T-SQL

How to Post Data/Code to get the best Help How to Post Performance Problems
Post #719921
Posted Tuesday, May 19, 2009 11:53 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Thursday, December 4, 2014 7:52 AM
Points: 9,294, Visits: 9,495
There's lots of COM stuff that isn't allowed in SQL Server/CLR.

-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung
Proactive Performance Solutions, Inc.
"Performance is our middle name."
Post #720074
Posted Wednesday, March 14, 2012 4:42 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 19, 2014 11:38 AM
Points: 122, Visits: 9,092
Hi did beyonder422 did you ever get a solution to this problem. I am having the exact same problem and can't find any information about it on Google.

Thanks



4x4 photos
Post #1266593
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse