Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


ADODB call error "Invalid URI: The URI is empty"


ADODB call error "Invalid URI: The URI is empty"

Author
Message
beyonder422
beyonder422
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
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='FormatNameBigGrinIRECT=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)
Florian Reischl
Florian Reischl
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1939 Visits: 3934
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 ? "" : frame.GetMethod().DeclaringType.ToString()),
frame.GetMethod().ToString(),
string.IsNullOrEmpty(frame.GetFileName()) ? "" : 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 ? "" : frame.GetMethod().DeclaringType.ToString()),
frame.GetMethod().ToString(),
string.IsNullOrEmpty(frame.GetFileName()) ? "" : 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
RBarryYoung
RBarryYoung
SSCrazy Eights
SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)

Group: General Forum Members
Points: 9436 Visits: 9517
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."
sqlcentral2@mailinator.com
sqlcentral2@mailinator.com
SSC-Enthusiastic
SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)

Group: General Forum Members
Points: 130 Visits: 9379
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search