WHAT CAN .NET CODE DO FROM WITHIN SQL

WHAT CAN .NET CODE DO FROM WITHIN SQL SERVER In addition to these libraries, SQL Server 2005 may load libraries that are referenced by these libraries. For example, System.Data.dll may have a reference to System.Drawing.dll, which may be loaded, but System.Data.dll will be coded not to reference certain entry points in System.Drawing.dll. The static list of Framework class libraries is enforced at runtime rather than catalog time; attempting to load a library not on the list will not throw an exception at runtime. Let s go through an example of how safety levels would work in practice. The following short program accesses a search service on the Web. This code uses System.Web. public static String WebSearch(String subject) { String url = http://www.websearch.com/search?subject= ; //Submit Web request and get response url = String.Concat(url, subject); WebRequest req = WebRequest.Create(url); WebResponse result = req.GetResponse(); Stream ReceiveStream = result.GetResponseStream(); String outstring = ; //Load response stream into string Byte[] read = new Byte[1024]; int bytes = ReceiveStream.Read(read, 0, 1023); while (bytes > 0) { outstring = String.Concat(outstring, System.Text.Encoding.ASCII.GetString(read, 0, bytes)); bytes = ReceiveStream.Read(read, 0, 512); } return outstring; } We ll use it as part of a class that is compiled into an assembly. Now, we define the assembly to SQL Server, using two CREATEASSEMBLYstatements and two symbolic names with different safety levels. Register the unrestricted access privileged assembly Create assembly with external access create assembly searchEA from c:typessearchEA.dll with permission_set = external_access go

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost JSP Web Hosting services

Bookmark the permalink.

Comments are closed.