I was working on my daughter's (George's) laptop the other night and made two mistakes. First, I was working on hardware after 8PM--this is a mortal sin as far as I am concerned. Next, I thought her drive had two partitions. It had one. I formatted both partitions. I shouldn't have. Thankfully, I discovered a program “Recover My Files” which after a considerable length of time (over 24 hours) was able to “unformat” the NTFS partitions. I, frankly was very grateful but sorta shocked as I assumed (incorrectly) that dropping a partition, creating a new partition and doing a full format would wipe the data. It does not. Each and every file on the drive was recovered (at least it looks like they were).
(Update: No, the Recover My Files program did not actually recover the data--at least it has not done so at this point. While it does see the files, when saved the files are corrupted.)
Another little issue: IBM (whose service is highly rated by Consumer Reports) sent George a “Used but Serviceable” replacement hard drive. It lasted about 18 hours before it failed. They're sending another. Perhaps it will last long enough to build a backup... This assumes that I won't be so tired that I delete the backup before getting a chance to install it. I wonder what data the replacement drive contains? Hummm, should I peek?
bv
I've made a decision to stop adding new content to my new book “Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)”. I finally came to the realization that I can't keep up with Microsoft and their constant churn. No, this does not mean I won't be publishing the book--hardly. It means that I'm going to trim back to 800 or so pages and publish the new stuff as EBook. This more closely follows the pattern used by Microsoft. That is, ship a product and then ship updates for the next couple of years (before it's made obsolete). ;)
To this end, the book's manuscript is now in the hands of the editors and reviewers. I hope to get it on the shelves this summer. The new support web site is up www.hitchhikerguides.net but not really ready for comments quite yet. Don't be surprised if the colors and layout change from minute to minute--I'm still tuning.
Let me end on this final note. This book would have been a lot harder without the help of Peter Blackburn. While he did not write a lot of content this time, he has been there during the entire process (over two years) keeping me on track, keeping my systems functional and keeping my eye on the ball when it comes to security issues. Thanks bud.
While I was invited to VSLive Orlando and DevTeach Montreal this year, I was forced to turn down these kind invitations. I am taking time off to speak at SQL/Visual Studio Connections in Orlando the week of April 4th. I'll also be passing through the Kansas City .NET user group on the way to give a talk on ADO.NET “Connecting“. I'm also giving a talk at TechEd in Boston and I hope to visit user groups out there if invited.
I'm focusing very heavily on my new book “Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)”. For the last month or so I've been focusing on the SQL Server CLR Executables chapter that has grown to over 90 pages so far. I've discovered a wealth of un and under documented features and issues that once discovered will make developing CLR stored procedures, functions, user-defined types, aggregates and triggers a lot easier. I also include a section on leveraging these executables from other applications--where it's possible.
Next on the agenda is the Visual Studio ReportViewer control and the reporting features of Visual Studio 2005.
Peter Blackburn and I hope to have the first draft done in the next couple of months and published by this summer. So far we have over 600 pages and we're still going strong.
Thanks for waiting.
Please report any problems posting to this blog. I have some pretty tight anti-spam tests in place that might have prevented some legitimate posts from being accepted. Generally, if your post contains more than two links, it's rejected. This approach was taken as the spammers invariably list a long list of links in their garbage posts. I also reject or delete posts that extole the virtues of President Cleveland--those simply can't be tolerated.
Generally, I don't like to answer 1:1 technical questions--I simply don't have the bandwidth. I do lurk on the public newsgroups and the MSDN forums which are good resources for free advice. I don't charge any more to answer questions on the forums than I do for questions sent via email, but you have a lot better chance of getting through my junk mail filters.
If you have comments that are not accepted, please feel free to email them to me. I will be happy to post them--whether or not I agree with the comments. My email address is
--be sure to put “Comments on blog subject <subject>” in the subject line.
Thanks
Updated: March 7, 2006: Added ASP.NET connecting info.
In the newsgroups and in my conference sessions, there still seem to be a lot of questions on getting connected. Perhaps this checklist can help. Yes, connecting can be a ... well, problematic. ASP apps also pose additional issues. In order to connect to SQL Server several factors must be in place. Go through this checklist to help get (and stay connected) to an instance of SQL Server.
1) Your application must identify the machine name and the instance of the target SQL Server. This means you’ll need to reference the machine name and the instance name unless you have installed SQL Server as the “default” SQL Server (the only option pre-SQL Server 2000). The syntax is “<machine name>\<instance name>”.
2) To identify the local machine name, you can use “.” or “(local)” or in VS 2005 (2.0 Framework) you can use My.Computer.Name. You can also define an alias to address a specific machine and instance and use this alias in the Server= element in the connection string. The term “localhost” refers to the local TCP/IP address and is used to access the local IIS server, not the local SQL Server.
3) When connecting to an instance of SQL Server directly via an IP address (which raises a number of scary security issues), see the addendum at the bottom of this checklist.
4) The DNS must be able to identify the named machine (it must resolve to a valid IP address). If the DNS is not working, the server can't be found. It might be necessary to alter the “hosts” file (Windows\system32\drivers\etc) to map a specific machine name to an IP address to circumvent this issue. DNS accessibility can be a function of how the NIC is configured or the availability (state) of the domain controller.
5) The targeted instance service must be running on the specified machine. SQL Server can be configured in single-user or paused mode or the service might be stopped for some reason. These states don't permit external connections. You can check the status of the service using the services.msc MMC snapin or via code (2.0 Framework).
6) If you're using SQL Server authentication, the server instance must be configured for mixed mode security. By, default SQL Server is not configured to support SQL Server authentication (what’s called “mixed-mode” security.
7) If you’re using SSPI authentication (Trusted Connection=True or Integrated Security=True (or SSPI)), the Windows account you’re using (or impersonating) must have an account on the server one way or another. This means there must be a SQL Server login that grants sufficient rights to the user’s group. By default, Windows users in the Administrators group are granted access to all objects but the DBA might (and usually does) restrict those rights.
8) In the ASP case, IIS opens the connection as ASPNET (pre-Windows 2003) so this login must be granted rights. Yes, you can try to impersonate a Windows user using an ASP application, but this is complex to setup and keep working. Other complicating factors here include running the SQL Server on a different system—other than the IIS system.
9) ASP applications might have to run under a trusted domain account.
10) The login account must exist and be granted rights to the initial catalog.
11) Depending on the protocol you choose (or is chosen for you), you must punch a hole or two in the client firewall if the server is on another machine. This means getting into the Windows firewall program. If the server is on the local system, it's best to bypass the network providers and use the shared memory provider. You must also make sure the protocols you need are enabled on the server--they are off by default. The best way to manage the services is using the new SQL Server Surface Area Configuration tool and the SQL Server Configuration Manager.
12) The server itself must have available connections. This is not a given. Check the server configuration to ensure that the license restriction or the DBA-imposed restriction on accounts has not been exceeded.
13) The connection pool must also have available space. The new ADO.NET 2.0 exception handlers are not that helpful. They often return a generic message that doesn't really help. The ConnectionString parser in ADO.NET 2.0 is better than ever. It’s more tolerant of additional spaces and such and will simply report an exception if the syntax is incorrect. That said, remember that the ConnectionString is used to test for existing connections in the connection pool. It can’t vary from connection-to-connection without creating a new pool. Connection pooling issues are not a concern for Windows forms applications (smart clients), but are a vital issue for ASP and Web Service applications.
14) For Windows 2000 and XP IIS logs on using “ASPNET” account credentials. For Windows 2003, IIS uses “INetworkService” by default. Some folks think that impersonating another account for XP and Windows 2000 is not that hard. They say there are two ways to do it:
a) In web.config: .
b) Change the anonymous account on the IIS server and in web.config set:
For Windows 2003 you must setup a new application pool with the new account as its identity. (Thanks to Patrik Löwendahl [C# MVP] for this contribution.)
15) When connecting to a SQL Server instance connected via IP address:
a. While 1433 is the official Internet Assigned Number Authority (IANA) socket number for SQL Server, you should still determine the port being exposed by the targeted server instance—each instance can be addressed by its own TCP port. The SQL Server Configuration Manager exposes the IP address of the TCP port if it has been assigned. If Dynamic Ports are enabled, then you need to determine that port. See KBs 269882, 823938 and 287932 for more details.
b. Using the same tool, make sure the TCP/IP protocol is enabled.
c. Using your Firewall administration tool on the client and the server, make sure this port is not blocked. It will be blocked by default.
d. Make sure your connection string uses “Network=dbmssocn;” as the protocol.
e. It might be easier to simply add an alias to the Host file located at “C:\WINDOWS\system32\drivers\etc”.
I think that covers most of the known issues. If you think I need to add more to the list, let me know.
Other useful links:
http://support.microsoft.com/Default.aspx?id=317012
I just spent over two days in the (sadly inept) hands of Qantas Airways--about 50 hours of hellish customer service. This trip was one of the most grueling I’ve ever had to endure. Since 1960 (when I made my first trans Pacific trip), I’ve sailed across and flown over the Pacific many (too many) times. I’ve flown there in a 707 in the late 60’s courtesy of the US Army—landing at
A few months ago I was invited to speak at VSLive in
The trip down to LAX (on
When we arrived in LA the transition to the international terminal was… well, interesting and a challenge in itself. There was no one to show the way and if it was not for a helpful TSA guard (who would have guessed), we would have never learned the secret handshake and hidden door to use. The signage at LAX is challenged at best. Once in the International terminal we ferreted out the Qantas gate. It was only by chance that I asked at the desk about our seat selection. It seems that
The flight from LAX to
Our problems began again as we boarded our flight from