<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andy's Techie Blog &#187; SQL Server</title>
	<atom:link href="http://andyparkes.co.uk/blog/index.php/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://andyparkes.co.uk/blog</link>
	<description>Professional Geek</description>
	<lastBuildDate>Tue, 07 Feb 2012 21:40:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Principal &quot;username&quot; is not able to access the database &quot;db&quot; under the current security context.</title>
		<link>http://andyparkes.co.uk/blog/index.php/2009/09/10/principal-username-is-not-able-to-access-the-database-db-under-the-current-security-context/</link>
		<comments>http://andyparkes.co.uk/blog/index.php/2009/09/10/principal-username-is-not-able-to-access-the-database-db-under-the-current-security-context/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 21:53:07 +0000</pubDate>
		<dc:creator>AndyParkes</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://andyparkes.co.uk/blog/index.php/2009/09/10/principal-username-is-not-able-to-access-the-database-db-under-the-current-security-context/</guid>
		<description><![CDATA[Just to remind me because I always forget about it I was trying to do some maintenance on the SQL database that I use for one of my sites. I used SQL Management Studio to connect ok but when I tried to expand the database container I got this error (with username and dbname being [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fandyparkes.co.uk%2Fblog%2Findex.php%2F2009%2F09%2F10%2Fprincipal-username-is-not-able-to-access-the-database-db-under-the-current-security-context%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fandyparkes.co.uk%2Fblog%2Findex.php%2F2009%2F09%2F10%2Fprincipal-username-is-not-able-to-access-the-database-db-under-the-current-security-context%2F&amp;source=AndyParkes&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p>Just to remind me because I always forget about it</p>
<p>I was trying to do some maintenance on the SQL database that I use for one of my sites.</p>
<p>I used SQL Management Studio to connect ok but when I tried to expand the database container I got this error (with username and dbname being specific to your site)</p>
<blockquote><p>The server principal &quot;<strong>username</strong>&quot; is not able to access the database &quot;<strong>dbname</strong>&quot; under the current security context.       <br />.Net SqlClient Data Provider in SQL Server Management Studio.</p>
</blockquote>
<p>&#160;</p>
<p>It’s a shared hosting plan so obviously the security is pretty tight but I couldn’t even view my own database </p>
<p>Fortunately the answer is simple (I found the answer on lots of sites <a href="http://www.kf7.co.uk/sql-server-principal-not-able-access-database.aspx">but this the first one i found</a> –thanks!)</p>
<blockquote><p><strong>Reason:</strong>      <br />This is because the MS SQL Server is attempting to execute a T-SQL query to retrieve a list of databases along with additional information about those databases. One of those pieces of information is &quot;Collation&quot;, which you will not have permission to action for all databases as you&#8217;re in a shared hosting environment and you only have access to your database alone.      </p>
<p><strong>Solution:       <br /></strong>Step 1: In Object Explorer, click Databases      <br />Step 2: Display Object Explorer Details (F7) or View &gt; Object Explorer Details      <br />Step 3: Right click the column headers and de-select &quot;Collation&quot;      <br />Step 4: Refresh Databases</p>
</blockquote>
<p>&#160;</p>
<p>Easy enough – once I’d stopped the collation field from displaying all was well</p>
<div><!-- Wordbooker created FB tags --> <fb:like layout="button_count" show_faces="false" send="false" action="like" font="arial" colorscheme="dark"  href="http://andyparkes.co.uk/blog/index.php/2009/09/10/principal-username-is-not-able-to-access-the-database-db-under-the-current-security-context/" width="250"></fb:like> <div style="float:right;"><!-- Wordbooker created FB tags --> <fb:share-button class="meta" type="button" href="http://andyparkes.co.uk/blog/index.php/2009/09/10/principal-username-is-not-able-to-access-the-database-db-under-the-current-security-context/" > </fb:share-button></div></div>]]></content:encoded>
			<wfw:commentRss>http://andyparkes.co.uk/blog/index.php/2009/09/10/principal-username-is-not-able-to-access-the-database-db-under-the-current-security-context/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

