Cannot Use Anonymous Methods Inside SQLCLR...
Sep 15, 2006
Hi all,
The problem is: when you're trying to call in method MyMethod anonymous method that doesn't use local variables, deployment of the assembly will fail referring that MyMethod tries to store smth. in the static variable. Indeed, looking at the compiled CLR code, you can see that anonymous delegate is cached in the private static delegate and the call looks like:
If(ClassName.privateStaticDelegate == null)
ClassName.privateStaticDelegate = new MyDelegate(HiddenMethodName);
CallAnonymousMethod(ClassName.privateStaticDelegate);
Is there any workaround to fix this problem.
P.S. I googled about this problem and found only one article on it:
http://www.ayende.com/Blog/default,date,2005-12-26.aspx
View 4 Replies
ADVERTISEMENT
Jan 31, 2006
Hi,
My .NET SQL UDF needs do very complex computation on every call regardless on user input. I would be very happy if I could cache this computed data somewhere in SQL Server memory. And then I should not need to recompute this complex information on every UDF call. Is it possible to cache something inside SQL Server from CLR ?
Thanks.
View 1 Replies
View Related
Jul 21, 2006
I suspect this is very poor design but I've been asked to research this: can I maintain a persistent communication session inside an sqlclr proc? (tcp/binary packets)
The process has to maintain very high throughput - setting up and tearing down a connection on each transaction is cost prohibitive. For TCO and deployment reasons it is preferable not to have a separate windows service etc that accepts requests from inside the clr proc. Is there the luxury of an alternative integrated into the database?
View 4 Replies
View Related
Jun 16, 2004
I was reading though my logs and noticed I had three instances of an anonymous logon last night. The last anonymous logon was at approx midnight. This is prime hacking time.
Can anyone give me direction on issues or concerns with anonymous logons.
Much thanks in advance ....
View 9 Replies
View Related
Feb 27, 2007
Hi all
I've got the following situation:
setup up an merge publication (distributor and publisher at the same server)
setup an anonymous subscription
deleted the subscription
In the replication monitor, I still see the deleted subscription.
Why?
And how do I get rid of it?
Thanks a lot for any informations and greetz
Aline
View 7 Replies
View Related
Sep 12, 2007
For inserting current date and time into the database, is it more efficient and performant and faster to do getDate() inside SQL Server and insert the value
OR
to do System.DateTime.Now in the application and then insert it in the table?
I figure even small differences would be magnified if there is moderate traffic, so every little bit helps.
Thanks.
View 9 Replies
View Related
Feb 15, 2001
How do you set up a SQL server to allow anonymous access from a website? I am using asp for a web site and keep getting this error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITYANONYMOUS LOGON'
I am new to SQL server so any help no matter how obvious would be appreciated
Thanks
View 1 Replies
View Related
Apr 9, 2008
We're getting a barrage of Windows Authenticated login attempts that are using the Anonymous login on one of our client's production servers. This smells to me of a service gone awry.
The login attempts originate from a server that is hosting some Quest Software applications, specifically their Performance Analysis tool. This machine has been well behaved until this morning, but it has been issuing around ten failed login attempts an hour.
The problem that it causing me pain at the moment is that the client has not renewed their Quest support yet because of a merger, so their contract recently expired. Does anyone have any insight into what might cause a normally well behaved app/server to go mildly berzerk exactly ten days after the support contract expires?
-PatP
View 3 Replies
View Related
Oct 24, 2006
Hi
I have a web sync merge publication with multiple anonymous subscribers. Unfortunately two of the subscribers have experienced errors as follows.
###############################################
The Merge Agent failed after detecting that retention-based metadata cleanup has deleted metadata at the Subscriber for changes not yet sent to the Publisher. You must reinitialize the subscription (without upload). (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199401)
###############################################
Now they successfully sync'd within the retention period so I am baffled as to why the cleanup has occured. Unfortunately I can't seem to find a way to reinitialize just a single subscriber. It seems that the only reinitialize option is across all subscribers, which I do not wish to do as they would loose any changes since last sync.
Can anyone shed any light on this.
Cheers
Rab
View 3 Replies
View Related
Mar 23, 2007
Hello,
I tried to use REPLMERG utility for Web synchronization and got the following error message in log file:
2007-03-23 14:35:10.484 The subscription to publication 'X' could not be verified. Ensure that all Merge Agent command line parameters are specified correctly and that the subscription is correctly configured. If the Publisher no longer has information about this subscription, drop and recreate the subscription.
The case description is as the following:
REPLMERG utility command line:
"C:Program FilesMicrosoft SQL Server90COMREPLMERG.EXE" -ExchangeType 3 -Publication X -
Publisher B01 -Subscriber 127.0.0.1SQLEXPRESS -Distributor B01 -PublisherDB DBS -
SubscriberDB DBS -PublisherSecurityMode 1 -Output C:TempDBS.log -OutputVerboseLevel 2 -
SubscriberSecurityMode 0 -SubscriberLogin Operator -SubscriberPassword XXX -
SubscriptionType 2 -DistributorSecurityMode 1 -Validate 3 -InternetURL
https://www.company.com/Synch/replisapi.dll -InternetSecurityMode 0 -InternetLogin USER1 -
InternetPassword PWD1 -SubscriberType 0
The subscription to the publication X has been created with the following T-SQL script:
USE DBS
EXEC sp_addmergepullsubscription
@publisher = N'B01',
@publication = N'X',
@publisher_db = N'DBS',
@subscriber_type = N'anonymous',
@sync_type = N'automatic',
@subscription_priority = 0.0;
I've also tried to check subscription information on the server 127.0.0.1SQLEXPRESS using the following:
sp_helpsubscription_properties N'B01', N'DBS', N'X'
but the result set is empty. When I run sp_helpsubscription_properties
I get the same empty result. But the subcription is anonymous and when I synchronize it using RMO - it works.
Could you please advice what could cause the problem?
Thank you.
Alexander.
View 16 Replies
View Related
May 6, 2008
In remote processing mode, I am receiving the following error when I view a report in the browser: HTTP status 401: Unauthorized.
I have SQL server 2005, Microsoft Internet Information Services (IIS) 6.0 , Windows Server 2003 running on a virtual PC.
I am using Visual Studio 2008 to create a webpage with a reportviewer.
We are using Windows Integrated Security. How do I provide anonymous access to the report viewer?
View 4 Replies
View Related
Aug 15, 2007
Hi,
I'm trying to force an anonymous subscription to re-intialize on it's next sync attempt. I can do this from the subscriber no problems, and from the publisher using 'Re-initalize All Subscriptions', but I can't seem to re-intialize only a single subscription from the publisher.
To do this I'm trying to execute sp_reinitmergesubscription using the subscriber details found in the sysmergesubscriptions table. This executes ok and when the subscriber starts to sync it does try to re-initialize starting with generating a new snapshot, but after processing for a while it throws the following error messages:
Error messages:
The merge process could not allocate memory for an operation; your system may be running low on virtual memory. Restart the Merge Agent. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147198720)
Get help: http://help/MSSQL_REPL-2147198720
An error occurred while reading the .bcp data file for the 'CDP_TableDates' article. If the .bcp file is corrupt, you must regenerate the snapshot before initializing the Subscriber. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199428)
Get help: http://help/MSSQL_REPL-2147199428
The merge process was unable to deliver the snapshot to the Subscriber. If using Web synchronization, the merge process may have been unable to create or write to the message file. When troubleshooting, restart the synchronization with verbose history logging and specify an output file to which to write. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201001)
There doesn't appear to be any shortage of memory on the server. There is no problem regenerating the snapshot from the publisher, and there's no problem with syncing through the web using delta syncs or re-initializing from the subscriber, so I can't see any obvious cause from those error messages.
I'm using SQL Server 2005 SP2 on the publisher, and SQL ServerCE 3.1 on the subscriber.
Any ideas or alternatives?
Cheers
View 10 Replies
View Related
Aug 3, 2007
Hi there,
I created reports and deployed successfully. but one problem i am facing is when i am opening the browser to see reports, it is asking for credentials..
But i want to show these reports for anonymous users
Is there any way to show reports for anonymous users? If yes, what is the process. please refer me any articles.
please help me out.
thanks
praveen.
View 3 Replies
View Related
Nov 12, 2007
Greetings,
I have a set of reports that should be accessible to any user on our network. Those reports are located in a single folder in SSRS. I would like to configure security to allow anyone to see the reports in that folder. Is there a way to do this?
I do have other folders where I am using security so I do not want to open up system-wide access to all reports.
Thank you for your ideas.
Rob
View 4 Replies
View Related
Nov 16, 2007
I'm trying to execute a stored procedure within the case clause of select statement.
The stored procedure returns a table, and is pretty big and complex, and I don't particularly want to copy the whole thing over to work here. I'm looking for something more elegant.
@val1 and @val2 are passed in
CREATE TABLE #TEMP(
tempid INT IDENTITY (1,1) NOT NULL,
myint INT NOT NULL,
mybool BIT NOT NULL
)
INSERT INTO #TEMP (myint, mybool)
SELECT my_int_from_tbl,
CASE WHEN @val1 IN (SELECT val1 FROM (EXEC dbo.my_stored_procedure my_int_from_tbl, my_param)) THEN 1 ELSE 0
FROM dbo.tbl
WHERE tbl.val2 = @val2
SELECT COUNT(*) FROM #TEMP WHERE mybool = 1
If I have to, I can do a while loop and populate another temp table for every "my_int_from_tbl," but I don't really know the syntax for that.
Any suggestions?
View 8 Replies
View Related
Dec 21, 2005
Hi,
I read the BOL on how the publisher will had out identity ranges to subscribers, but it was not clear if this was also the case for anonymous subscribers. Will merge replication with identity columns work with anonymous subscribers that sync via HTTPS?
Thanks,
Darrell Young
View 1 Replies
View Related
Oct 30, 2015
I am trying to execute oracle procedure (anonymous block) with input and output parameters from ms sql code and return 2 values back:a number and a string.I am using **EXEC() AT** to execute oracle code and return a string back to ms sql. It works fine when returning numbers, but if I add a string output parameter, I am receiving an error:Msg 0, Level 11, State 0, Line 0...A severe error occurred on the current command. The results, if any, should be discarded.
The server log has the following entry in exception.txt:
Exception 0xc0000005 EXCEPTION_ACCESS_VIOLATION reading address 00000005031C07E0 at 0x0000000070F9C183
There is also a SQLDump file generated:
* BEGIN STACK DUMP:
* 10/28/15 12:45:38 spid 63
* Exception Address = 000000005040C183 Module(MSVCR100+000000000003C183)
[code]....
It looks like the problem is in passing varchar2 from oracle into ms sql. I had logging code in oracle block, and it works fine. I have found a few examples of using **exec() at** but there is always only integer output passed back.
View 3 Replies
View Related
Aug 8, 2006
Hi
We are using HTTPS merge replication
Our setup is as follows:
subscription.CreateSyncAgentByDefault = False -- I wrote a windows service to synchronise
subscription.UseWebSynchronization = True
subscription.InternetSecurityMode = AuthenticationMethod.BasicAuthentication
subscription.SubscriberType = MergeSubscriberType.Anonymous
Some of our subscribers have low-quality internet connections - how do I get the agent at the publisher/distributer use a slower profile - I've read How to: Work with Replication Agent Profiles (Replication Transact-SQL Programming)
but can't see where you specifiy an alternate agent profile
On the distributer / publisher (same machine) I go to replication monitor -> Warnings and Agents - I can only set the profile for the snapshot agent....
thanks
Bruce
View 4 Replies
View Related
May 26, 2008
Just wonder whether is there any indicator or system parameters that can indicate whether stored procedure A is executed inside query analyzer or executed inside application itself so that if execution is done inside query analyzer then i can block it from being executed/retrieve sensitive data from it?
What i'm want to do is to block someone executing stored procedure using query analyzer and retrieve its sensitive results.
Stored procedure A has been granted execution for public user but inside application, it will prompt access denied message if particular user has no rights to use system although knew public user name and password. Because there is second layer of user validation inside system application.
However inside query analyzer, there is no way control execution of stored procedure A it as user knew the public user name and password.
Looking forward for replies from expert here. Thanks in advance.
Note: Hope my explaination here clearly describe my current problems.
View 4 Replies
View Related
Jul 26, 2006
Dear all,
Basically I want to set chain up the rights so that the anonymous web user IUSR_ .. can execute the new .NET subs, functions etc in the assembly, just as the anonymous web user can execute Stored Procedures when granted. In this way, it should be possible to call the .NET assembly just as classic stored procedures from ASP/ASP.NET.
I have written a .NET function which I can successfully execute if I log on to the database as an administrator by sending this T-SQL query; it returns the result of a given string:
select dbo.CLRHTMLString('abc')
The scenario is now to try to grant access to this assembly for a different role (webuser), which the classic IUSR_MYSERVERNAME is a login of, so that I can call the .NET Assembly when I am authenticated as the anonymous web user (e.g. via ASP, etc.).
To test access, I created a login (webusertest) for a user (webusertest) in the same role (webuser) on the database. But when I use this login, which supposedly has the same rights as the IUSR_, execution right is denied:
EXECUTE permission denied on object 'CLRHTMLString', database 'adt_db', schema 'dbo'.
Note: The 'webuser' database role has Execute permission on the Assembly.
I have also tested this from my actual web page, with the following results:
(1) IUSR_MYSERVER member of db_owner role: Web page has right to call assembly.
(2) IUSR_MYSERVER not member of db_owner role: Web page does not have right to call assembly.
Further test results:
(3) Function can be called when making the user "webusertest" member of the "db_owner" role, which is too much rights to grant for the anonymous web user.
(4) When adding the user 'webusertest' to get 'Execute' permissions on the assembly, it does not get added. After clicking OK, there is no warning message, but when opening the Assembly Properties -> Permission dialog box the same time, the 'webusertest' user does not appear in the list.
Thankful for any advice on this matter.
View 4 Replies
View Related
Aug 9, 2006
Is anyone here aware of any explicit/definite differences between running sqlclr on 32-bit and 64-bit.
Note: These must be documented, well defined differences.
View 5 Replies
View Related
May 9, 2008
I'm having a problem executing a SQLCLR function: this function
calls a web services that processes a query to a data base and
returns a table to be used in a stored procedure. In a low
concurrency scenario (not to many clients connected), the function
returns correctly, however when the concurrency level is increased
we have a SQLCLR command execution problem (all the SQLCLR
processes hangs), making the server unavailable to all web services
processes.
At first we thought the problem could be the SQLCLR, since the web
services is 100% available, all the time. We monitored to come to
this conclusion. Do you know of some SQLCLR bug?
Could someone help me with this? I'm in a difficult situation with
my client, considering that we defended the MS SQLServer technology
and now it's not working properly.
View 7 Replies
View Related
May 15, 2006
I'll keep trying new threads here... sooner or later, I'm sure an expert Microsoft CLR employee will gladly lend a helping hand!
The pieces:
1. SQL 2005, MS Windows Server 2003, Standard Edition, SP 1
2. .NET 2005/C#
3. Instance of SQL 2005 running locally.
Trigger on local SQL2005 DB table INSERT calls 2 CLR Functions:
1. Retrieve data from SQL2005 DB table and populate local DBF through OLEDB
2. Call external 16-bit application (written in Clipper) that iterates through local DBF records (added from step 1 above) and populates DBF on domain resource.
Step 2 detail:
External 16-bit application is called by CreateProcessAsUser after impersonating token.
THIS IS SUCCESSFUL - IF: I populate SQL2005 DB table using TSQL insert statement. The trigger executes, Step 1 and Step 2 execute perfectly!
THIS IS UNSUCCESSFUL - IF: The SQL2005 DB table is populated by synchronizing SQL Mobile Server database from a SQL Mobile Edition 2005 PDA emulation. The trigger executes. Step 1 executes perfectly. Step 2 executes without exceptions. HOWEVER, the 16-bit application does not execute! Remember, no exceptions. In fact, the result variable returns true from function below:
result = ProcessUtility.CreateProcessAsUser(
hDupedToken,
null,
@"C:MobileDBMobile.exe",
ref sa, ref sa,
false, 0, IntPtr.Zero,
@"C:MobileDB", ref si, ref pi
);
Also, if I Right-click on the Step 2 function in the Server Explorer and click "Execute", it works perfectly. Domain DBF is updated successfully.
So, in short CLR "CreateProcessAsUser" is not doing it's job when the trigger is fired after SQL 2005 DB is populated via replication/sychronization. I would appreciate a response... Thx!
View 6 Replies
View Related
Jun 5, 2007
Set myConn1 = Server.CreateObject("ADODB.Connection")
Set myRs1 = Server.CreateObject("ADODB.Recordset")
Can anybody tell me what the ADODB in these two statements is telling me?
View 3 Replies
View Related
Sep 4, 2007
Hi,
I plan to implement UDT for division methods.
The following fragment TSQL with zero check:
DECLARE @a int, @b int
SELECT
CASE WHEN @b = 0 THEN NULL
ELSE @a / @b
END
Clr UDT may look like this and script will be shorter.
DECLARE @a int, @b int
SELECT @a Type :: divide(@b)
Is that better to use UDT ?
Anyone have try this before?
View 8 Replies
View Related
Apr 4, 2007
Is there a way to retrieve the methods within an assembly that are attributed with SqlTrigger or SqlProcedure using T-SQL?
View 1 Replies
View Related
Aug 31, 2007
Hi,
I'm a newbee to replication and wanted to know about the whole mechanism of replication and how is two way replication implemnted on 2 diffrent servers located at 2 different remote locations????
View 2 Replies
View Related
Apr 8, 2008
I'm personally in favor of using the SQL CLR where appropriate, although I'm wondering what the negative consequences of enabling SQL CLR might be? Its disabled by default within SQL Server 2005 and most likely 2008, so what was the reason behind this ... beyond the fear of the DBA enabling something he might not himself fully understand.
Thanks,
Doug Holland
View 1 Replies
View Related
May 11, 2006
By using impersonation I am able to push data to network path / old fashioned DBF's. Of course, I must use unsafe. I am unable, however to successfully run a "cmd.exe" process(), even if I populate the Username, Domain and password (with securestring). It authenticates correctly (checked by giving wrong password or bad username). But when it runs (even just a "cmd.exe"), I get an access is denied error...
StreamWriter sw = File.CreateText("C:\Error.txt");
WindowsIdentity clientId = null;
WindowsImpersonationContext impersonatedUser = null;
clientId = SqlContext.WindowsIdentity;
impersonatedUser = clientId.Impersonate();
System.Security.SecureString password = new System.Security.SecureString();
foreach (char c in "secret")
password.AppendChar(c);
Process p = new Process();
ProcessStartInfo si = new ProcessStartInfo("cmd.exe");
si.UserName = "MyName";
si.Password = password;
si.Domain = "MySecretDomain";
si.UseShellExecute = false;
try
{
p.StartInfo = si;
p.Start();
}
catch (Exception ex)
{
//handle the exception here (This exception handler will not handle the exception, but I get a
//Window popup (While executing my CLR!!!)
}
finally
{
sw.Close();
}
The message popup says: The application failed to initialize poperly (0xc0000142). Click on OK to terminate the application. I'm kind of at a loss...
I'm using a Windows 2003 server box with the latest SQL Server 2005, .NET 2.0/2005. Let me know if you need anything else.
Oh, just FYI - I am moving replicated data from SQL2005 server to a legacy app using DBF (FoxPro driver). I really need an external DOS app to process some data for the DOS application (Clipper).
View 3 Replies
View Related
Jan 4, 2006
Running SQL Dev Edition on Win2K3 Enterprise Edition. I get the following error.
Msg 6522, Level 16, State 2, Line 2
A .NET Framework error occurred during execution of user defined routine or aggregate 'AddressCorrect':
System.DllNotFoundException: Unable to load DLL 'D:CorrectA.dll': Not enough storage is available to process
this command. (Exception from HRESULT: 0x80070008)
System.DllNotFoundException:
at UserDefinedFunctions.CorrectA(String query, String sentlen, StringBuilder errcode, StringBuilder FirmName, StringBuilder urbanization, StringBuilder Dline1, StringBuilder Dline2, StringBuilder LastLine, StringBuilder Stringaddress, StringBuilder DPC, StringBuilder Checkdigit, StringBuilder cityname, StringBuilder stcode, StringBuilder zip, StringBuilder addon, StringBuilder croute, StringBuilder LACS, StringBuilder LOTsequence, StringBuilder LOTcode, StringBuilder PMB, StringBuilder results, StringBuilder strnum, StringBuilder secname, StringBuilder secnum, StringBuilder countyname, StringBuilder countynum)
at UserDefinedFunctions.AddressCorrect(String inputAddress)
Box has 2GB Ram, with no other processes runing, cant understand why it says out of memory.
Appreciate any insights.
Thanks,
Saptagiri
View 11 Replies
View Related
Oct 4, 2007
I am searching for a way of using SQLCLR to do Bulk Insert/Copy within SQL Server 2005.
I am not permit to use SQL command BULK INSERT with any of text based file csv, or xml etc.
I did tried to use SqlBulkCopy within SQLCLR but failed, the context connection was not allowed, I did also use normal connection string with sa & pwd but no luck.
I understand that I can move bulk insert to a service such as windows, web or WCF but it is not on the card at present.
Is there a way of doing this within CLR, size of bulk is fair about 2000+ rows.
If you have solution, sample or link would be appriciated.
Cheers
Punprom Kasemsant.
View 2 Replies
View Related
Aug 27, 2007
Hi,
I have an SQLCLR assembly which is required to connect to a remote WCF service. In order to do this in a host such as IIS you would need to store all your WCF configuration data (endpoints, types etc) in the Web.config or App.config (in a windows forms app). This begs the question: Where do you store configuration data for SQLCLR assemblies?
The System.Configuration assembly is available in the SQLCLR, but this assumes a Web or App config files exists? Does SQL have its own config file that you can keep your settings in which is called when the assembly is running from within the SQL process?
If this is not possible, should I rather be storing configuration data in the database itself?
This particular example relates to WCF configuration but is relevant for assemblies using Enterprise Library which is also config driven.
Any help would be appreciated.
Chris
View 3 Replies
View Related
Aug 29, 2006
I am looking for a good method to do table lookups in a 2003 SQL database. I am retrieving products from an item table and then want to do value lookups in related tables in the same database like category name, category type, brand name etc. These values are referenced in the item master file by guid links to related tables.I am using a datareader to loop through the Select records and then I am writing results to a tab delimited data file for a data conversion. I am limited to net 1.1 and so can't use the 2.0 executescalar for single lookups.What would be the more efficienct method to use?'Dim myItemData As New DataReader Dim myItemReader As SqlClient.SqlDataReaderDim myItemCommand As New SqlClient.SqlCommand Dim myConnection = New SqlClient.SqlConnection("server=sql01.xxx") myItemCommand.Connection = myConnectionmyItemCommand.CommandText = "SELECT ""mf_items"".""item_guid"", ""mf_items"".""item_description"", ""mf_items"".""item_wholesale_price"", ""mf_items"".""item_description_title"",""mf_items"".""item_cd"",""mf_items"".""category_guid"" FROM ""CDB006"".""dbo"".""mf_items"" WHERE ""mf_items"".""item_closed"" = 0 And ""mf_items"".""item_visible"" = 1 AND ""mf_items"".""item_available"" = 1"myItemCommand.Connection.Open()myItemReader = myItemCommand.ExecuteReader()Dim myfileout As StreamWritermyfileout = File.CreateText(Server.MapPath("out.txt"))myfileout.WriteLine("link" & vbTab & "title" & vbTab & "description" & vbTab & "price" & vbTab & "image_link" & vbTab & "category" & vbTab & "id")While myItemReader.ReadIf myItemReader.Item(4).ToString() > "" And Val(myItemReader.Item(2).ToString) > 0 Then'what method to to look up for example the category name using the category_quid referenced in the item master'Write out record for parts file
View 2 Replies
View Related