It's a long long way to Tipperary (quando non hai i privilegi di Admin).

Ogni volta che mi sembra di avere un quadro sufficientemente completo per lavorare mi imbatto in un ennesimo problema che mi sbarra la strada. Grazie al cielo c'è santo Google, che (quasi sempre) mi rimanda a qualche pagina web che mi aiuta a superare l'impasse.

Questa volta è il turno di SQL Server 2005 Express.

Essendo passato a VS 2008 (su S.O. Vista Ultimate) ho pensato bene (?!?) di cominciare finalmente a sviluppare come utente normale e non come admnistrator. E così, appena ho provato a creare una Data Connection su un database di SQL Server Express, mi sono beccato il seguente errore:

Generating user instances in SQL Server is disabled.
Use sp_configure 'user instances enabled' to generate user instances.

La prima soluzione trovata su web (da smanettone, della serie "non comprendo ma mi adeguo"):

Aprire SQL Server Management Studio Express.
In the query editor type this text:

  • exec sp_configure 'user instances enabled', 1

Execute it.

Then type:

  • Reconfigure

Execute it.

Then restart the SQL Server database.

Però, poichè se posso preferisco comprendere, ho trovato qualcosa di più interessante leggendo SQL Server 2005 Express Edition Books Online (User Instances for Non-Administrators):

The user instance, also known as a child or client instance, is an instance of SQL Server that is generated by the parent instance (the primary instance running as a service, such as SQLExpress) on behalf of a user. The user instance runs as a user process under the security context of that user. The user instance is isolated from the parent instance and any other user instances running on the machine. The user instance feature is also referred to as “Run As Normal User” (RANU).

Note: For consistency purposes, SQL Server Express Books Online refers to this feature as user instance.

Also, this feature is available only with the SQL Server 2005 Express Edition.

Quando si installa SQL Express tale funzionalità non è abilitata, ed è per questo motivo che bisogna eseguire le due query sopra riportate.

Una volta abilitata, la "User Instance" viene attivata inserendo nella Connection String il testo "user instance=true", come riportato nel suddetto articolo:

To invoke the user instance, use the user instance connection string keyword in SQLClient, which can be true or false, and defaults to false. When set to false, no user instances support is in effect and original behavior is preserved. If user instance is set to true, the user instance model will be activated during ADO. NET connection.open call.

Non so se VS 2005 lo faccesse già (io giravo come admin) ma ora che sono un utente normale (quanto normale non lo so...) Visual Studio 2008 l'inserisce di default nella connection string:

image 

Morale della favola:

  • Se vi piace il meccanismo della User Instance, dovete abilitare tale funzionalità in SQL Server 2005 Express come sopra illustrato;
  • Se non vi piace la User Instance, e utilizzate il wizard di VS2008 per creare la stringa di connessione, ricordatevi di aprire le "Advanced Properties" di "Add Connection" e impostate "User Instance" a False.

Un'altro pezzo di strada verso lo sviluppo senza privilegi di amministratore!

posted @ lunedì 26 novembre 2007 16:48

Print
Comments have been closed on this topic.
«aprile»
domlunmarmergiovensab
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011