Friday 8 June 2007

Sql Server problem when attaching db with CLR objects

If you detach and then attach again, even if on the same server, a SQLServer 2005 database that has CLR stored procedures and functions you can receive the following message:

Msg 10314, Level 16, State 11, Line 1
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65538. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:
System.IO.FileLoadException: Could not load file or assembly 'etere.playout.sqlserver, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A)
System.IO.FileLoadException:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)

MS says that only assemblies with UNSAFE or EXTERNAL_ACCESS are affected by the problem. The following MS knowledge base article explains the situation: http://support.microsoft.com/kb/918040,

I've tried to change the db owner as the article says, but it won't be working for me... maybe beacuse I was using TRUSTWORTHY ON. Don't know. Anyway I've tried to reissue the TRUSTWORTHY ON properties into the DB and... magic ! now works.

so if you are using the TRUSTWORTHY ON remember to include it after reattaching the db:

ALTER DATABASE databasename SET TRUSTWORTHY ON
EXEC sp_changedbowner '?????'

Tuesday 27 March 2007

Irritating one-sided policies by Microsoft applications ...

When you launch MS outlook it performs some action that may be really irritating... one of this is that it changes the default mailto action and associate it to outlook. I actually have 2 email clients on my desktop, we are migrating to outlook from novell groupwise, and I want to use groupwise until migration is complete... but once I launched outlook... no more mailto.... I've tried with several configurations such as the default mail application, but none has worked. So I've decided to change the mailto association directly inside the registry:
  • Go to HKEY_CLASSES_ROOT\mailto\shell\open\command
  • Change the value of the (Deafult) string
For outlook it may look like this: "C:\PROGRA~1\MICROS~2\OFFICE11\OUTLOOK.EXE" -c IPM.Note /m "%1"
for Novell groupwise it is something like that: C:\Novell\GroupWise\gwmailto.exe /%1

Now I'm happy :)

Wednesday 21 February 2007

The GotDotNet site is being phased out

We are phasing out GotDotNet for the following reasons:
  • Microsoft wants to eliminate redundant functionality between GotDotNet and other community resources provided by Microsoft
  • Traffic and usage of GotDotNet features has significantly decreased over the last six months
  • Microsoft wants to reinvest the resources currently used for GotDotNet in new and better community features for our customers
well... what to say.. I was very affectionate to thE site, so this is a sad day for me. I will really miss the off topic discussion thread... how many heated debates there... hope that MS will open something similiar on his boards, even if I think it would never happen in a short time... at least not until they have such 'NAZI admins' (thanks to MStarr for his definition!!!)

Thursday 8 February 2007

ASCII/Multibyte to Unicode conversion

I've just posted a new article on converting ASCII/Multibyte to unicode using C# and SQL/CLR Integration.
You can see it online on codeproject at the following address:
 

Wednesday 7 February 2007

Kid's Programming Language

Do you enjoy programming and would you like that your children will do it too ? well consider to take a look to KPL (Kid's Programming Language): it is a freeware educational program developed by Morrison Schwartz, a software development and consulting company, with the following goals (extracted from KPL manual):
  • • We wanted to teach our own kids how to program
  • • We have fond memories of starting as programmers by coding games in BASIC
  • • Beginning programmers have been forgotten by the software industry for 20 years
  • • Specifically, VS.NET and Eclipse, the industry standard development environments, are NOT beginner environments Educational software could do much more for kids if it were easier to create, and with KPL it now is easier to create – even by teachers or parents who are not professional programmers
Another cite from TechWeb: "Microsoft has signed on to promote a new programming language intended to replace BASIC as the first step students take towards learning how to code. The Kid's Programming Language, or KPL, was developed under the direction of Jonah Stagner, and his colleagues, ex-Microsoft program manager Jon Schwartz and former NCR engineer Walt Morrison. The three run the software consultancy Morrison-Schwartz Inc. "

Monday 5 February 2007

MS Robotics Studio

Robotics Studio is a Windows-based environment for academic, hobbyist, and commercial developers to easily create robotics applications across a wide variety of hardware.
The interesting thing is that within MSRS ships a technology called CCR:
Cite from Channel9 "The Concurrency and Coordination Runtime (CCR) is a lightweight port-based concurrency library for C# 2.0 developed by George Chrysanthakopoulos in the Advanced Strategies group at Microsoft. Here, we have a deep discussion about CCR with George, a Software Architect, and Satnam Singh, Architect. You can get more info about CCR on the CCR Wiki. This is super cool stuff and represents a really innovative approach to making managed threaded programming more readily understandable and predictable. "

http://go.microsoft.com/?linkid=6122450

http://channel9.msdn.com/Showpost.aspx?postid=143582

How to setup Distributed Transaction Coordinator

The problem is really simple: You issue a query against a linked server and want to use transactions, but you get back an error, something like "The partner transaction manager has disabled its support" or "Distributed transaction coordinator has failed to ..."Ok, this is how you can set-up DTC to make distributed queries to work:

First verify the "Distribute Transaction Coordinator" Service isrunning on both database server computer and client computers
1. Go to "Administrative Tools > Services"
2. Turn on the "Distribute Transaction Coordinator" Service if it is not running.

If it is running and client application is not on the same computer as the database server, on the computer running database server
1. Go to "Administrative Tools > Component Services"
2. On the left navigation tree, go to "Component Services > Computers > My Computer" (you may need to double click and wait as some nodes need time to expand)
3. Right click on "My Computer", select "Properties"
4. Select "MSDTC" tab
5. Click "Security Configuration"
6. Make sure you check "Network DTC Access", "Allow Remote Client", "Allow Inbound/Outbound", "Enable TIP" (Some option may not be necessary, have a try to get your configuration)
7. The service will restart
8. BUT YOU MAY NEED TO REBOOT YOUR SERVER IF IT STILL DOESN'T WORK

On your client computer use the same above procedure to open the "Security Configuration" setting, make sure you check "Network DTC Access", "Allow Inbound/Outbound" option, restart service and computer if necessary.

On you SQL server service manager, click "Service" dropdown, select "Distribute Transaction Coordinator", it should be also running on your server computer.


Click here to see the MSDN thread with the original link by mornigsunshine.