MS SQL Server
  Home arrow MS SQL Server arrow Page 4 - Configuring SQL Server Express 2005
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MS SQL SERVER

Configuring SQL Server Express 2005
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 45
    2004-09-09

    Table of Contents:
  • Configuring SQL Server Express 2005
  • The Easy Part – Installation
  • The Not-So-Easy Part – Configuration
  • Next – Connecting to Your Application
  • The Connection String

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Configuring SQL Server Express 2005 - Next – Connecting to Your Application


    (Page 4 of 5 )

    Now of course we haven't configured enough to actually hook the database server to your web application. We could only accomplish that if you're using integrated Windows authentication on your web application, and you're the only one using it. And of course as a web developer, you know the vast improbability of and problems with those two assumptions.

    So basically, we need to create a login account for the web application. For this we'll use a SQL Server login, not Windows. So we will need to user different stored procedures. What are they?

    Well before we even get into that, there's a slight problem. When SQL express installs, it installs in Windows Authentication mode, which is exactly what we don't want. We want Mixed Authentication mode, which will allow us to login from Windows, or with a SQL login. And once again there's no GUI tool to enable that.

    So fire up your good old 'regedit', it's time to hack about in the registry itself! Navigate to:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer

    You'll see that the key 'LoginMode' is set to 1. Just open it, and change it to 2! That's it! Easy as pie! (what's the point of that expression, is pie really that easy?)

    Now we're able to add a SQL Login. We'll use the stored procedure 'sp_addlogin'. Make sure you have the SQLCMD open, and type in:

    > EXEC sp_addlogin '[newUserName]', '[newPassword]'
    > GO

    By the way, be sure to use a strong password, for security purposes. This will be encrypted and stored in the system table. Your safest bet is to have a different login for each web application. Now all we have to do is give the user we create permissions on the database we created. You should never use the 'sa' account from within your applications! For our task, we'll use one last stored procedure: 'sp_grantdbaccess'.

    But first we must actually use the database we created. You can do that one of two ways. If SQLCMD is still open, type in:

    > USE [database name]
    > GO 

    or, re-open SQLCMD with -U parameter, like this:

    SQLCMD.exe -S (local)\SQLExpress -U [database name]

    Now that we're using the new database, we can grant the user permissions. Type the following:

    > EXEC sp_grantdbaccess '[login]'
    > GO 

    And there you have it, you can log in, and so can your web application!

    More MS SQL Server Articles
    More By Justin Cook


       · I just wanted to leave you my compliments and thanks for the great article. I had...
       · 
       · ----------------------------------------Get free email at...
       · At the second step when I enter the command for EXEC sp_grantlogin...
       · Many thanks - I found your article very helpful. Just one thing. I believe that the...
       · Same problem I am having.
       · Can you register SQL 2005 Express server with SQL Enterprise Manager (GUI tool to...
       · What is going to happen when the app is published to a website on a server operated...
       · I came across the same error when I tried using MachineName/UserNameWhat I tried...
       · Thanks for the amazing tutorial. Got me up and running with no errors in 5 minutes!...
       · tnx, it has been very helpfull
       · Hi this article looks very relevant however before i start i would be grateful...
     

    MS SQL SERVER ARTICLES

    - Completing the Introduction to Transact-SQL
    - A Brief Introduction to Transact-SQL
    - Lookups and Blocking Bad Data
    - Field Validation Rules for Blocking Bad Data
    - Using Masks to Block Bad Data
    - Blocking Bad Data
    - Using @@ROWCOUNT and TABLE Variables for Dat...
    - How to Use Variables, IF and CASE in Databas...
    - Creating Important Aspects of Notification S...
    - Working wth Variables in Database Interactio...
    - Delving Deeper into Notification Services
    - Notification Services
    - Building a Multi-table Report with SQL 2005 ...
    - A Secure Way of Building Connection Strings
    - Transferring a Database Using the SSIS Desig...

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT