You are on page 1of 12

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 1 of 12

4,147,295 members and growing!

14,340 now online.

Email

Home

MFC/C++

C#

ASP.NET

VB.NET

Architect

SQL

All Topics

All Topics, MFC / C++ >> Database >> General (Beginner)

Hands on how to configure the Microsoft MSDE


By Lars-Inge Tnnessen.

An article on how to setup and configure the MSFT MSDE 2000.

ANNOUNCEMENTS
Vista API competition $10,000 in prizes Vista Mobile comp: Win a Samsung UMPC Vista Secure API comp: Win a Laptop! VB6 Interop Comp Win an Xbox Elite! Monthly Competition
Print Broken Article?

Search
Bookmark Discuss Send to a friend

Articles

Introduction
This article describes how to configure the Microsoft MSDE database engine
z z z z z z z z z z z z z z z z z z z z z z

What is MSDE? Limitations What you get How to install and configure the MSDE Arguments to the setup.exe file Using the setup.ini file Post reconfiguration Configure the server Configure the client Fire it up! How do I determine what version I am running? Create and delete a database How do I list all the databases on the system? How do I detach a database from the system? How do I attach a database to the system? How do I list all tables in a database? Database users Add a new user with SQL authentication With Win authentication How to list all users and roles in a database How to remove users from a database Exit osql

What is MSDE?
MSDE is a limited version of the Microsoft SQL Server. In short, it is the Mi the fancy UI tools, and with some limitations in the database size and the can be distributed embedded in your own applications or as a small stand businesses with less than 25 simultaneous users. The database is limited t it to a full Microsoft SQL Server without any limitations. Among the choices MSDE database is a good and affordable starting point for any business, or

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 2 of 12

not have to be installed on the hard drive on the deployment computer, bu

Limitations
There are some limitations to a MSDE database. You dont get:
z z z z z z z z z z z z z z z z z z z z z z z z z

Failover clustering. Log shipping. Parallel DBCC. Parallel create index. Enhanced read ahead and scan. Indexed views. Federated database server. System area network support (SAN). Graphical DBA, and developer utilities and wizards. Full-text search. Analysis services. OLAP partitions. Partition wizard. Linked OLAP cubes. ROLAP dimension support. HTTP Internet support. Custom rollups. Calculated Cells. Write back to dimensions. Very large dimension support. Actions. Real-time OLAP. Distributed partition cubes. Data mining. English query.

What you get


This is what you get:
z z z z z z z

Maximum number of processors: 2 in NT/Win2000/XP/2003, 1 in Win Maximum physical memory: 2 GB. Maximum user connections: 5 before the work load governor will lim Maximum data storage: 2 GB. Desktop embedded or network access. Leading SQL database performance. Its free. =:-)

How to install and configure the MSDE


The MSDE can be downloaded from the Microsoft web site for free. Downlo hard drive. There are four different ways to run the MSDE depending on ho below. You can configure the MSDE in three different ways:
z

Arguments to the setup.exe file.

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 3 of 12

z z

Using the setup.ini file. Post reconfiguration.

The four different running modes are:


z z z z

Windows authentication without network access. Windows authentication with network access. Mixed Windows and SQL mode authentication without network acces Mixed Windows and SQL mode authentication with network access.

Please use Windows authentication whenever possible. SQL mode will send network in plain text. This means it can be sniffed by intruders or hackers. more about on these web pages MSDN [1], and MSDN [2]. A default instal Windows authentication mode. Before you start the installation of the MSDE, disable Norton Antivirus and installation has completed. Norton Antivirus will not let you install the MSD In all of our examples, we will be using password for the system adminis

Arguments to the setup.exe file


You can run configure the MSDE by giving arguments to the setup.exe file Windows authentication with network access. Example 1 (Win access over a network). In this example, we will be using Win authentication, because we do not w over the network. Only Windows applications and .NET applications can ac login name and password on the client computer to login to the MSDE.
C:\...MSDE\>Setup.exe DISABLENETWORKPROTOCOLS=0 SAPWD="password "INSTANCENAME="myinstance"

Mixed Windows and SQL mode authentication with network access Example 2 (Java and Win access over a network): In this example, we will be using the mixed mode authentication, because applications and Java applications over a network. The username and pass
C:\...MSDE\>Setup.exe DISABLENETWORKPROTOCOLS=0 SAPWD="password " INSTANCENAME="myinstance" SECURITYMODE=SQL

Mixed Windows and SQL mode authentication without network acc Example 3 (Local Java and Win access only): In this example, we will not be granting access from the network. Only loc mixed mode authentication for Java applications.

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 4 of 12

C:\...MSDE\>Setup.exe SAPWD="password "INSTANCENAME="myinstance" SECU

Windows authentication without network access Example 4 (Local Win access only): In this example, we will not grant network access to the database. We will most secure setup, and should be used for embedded MSDE applications.
C:\...MSDE\>Setup.exe SAPWD="password " INSTANCENAME="myinstance"

Using the setup.ini file


You will find a file called setup.ini in the MSDE folder, if you want to use with read access to this file can see the system administrator password if t
[Options]

Here you will enter the configuration arguments. Mixed Windows and SQL mode authentication with network access Example 1 (Java and Win access over a network): In this example, we will be using mixed mode authentication, because we applications and Java applications over a network. The username and pass
[Options] DISABLENETWORKPROTOCOLS=0 SAPWD="password " INSTANCENAME="myinstance" SECURITYMODE=SQL

To install MSDE, run the setup.exe install application. Windows authentication with network access. Example 2 (Win access over a network): In this example, we will be using Win authentication, because we do not w over the network. Only Windows applications and .NET applications can ac login name and password on the client computer to login to the MSDE.
[Options] DISABLENETWORKPROTOCOLS=0 SAPWD="password " INSTANCENAME="myinstance"

To install MSDE, run the setup.exe install application.

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 5 of 12

Mixed Windows and SQL mode authentication without network acc Example 3 (Local Java and Win access only): In this example, we will not be granting access from the network. Only loc mixed mode authentication for Java applications.
[Options] SAPWD="password " INSTANCENAME="myinstance" SECURITYMODE=SQL

To install MSDE, run the setup.exe install application. Windows authentication without network access Example 4 (Local Win access only): In this example, we will not grant network access to the database. We will most secure setup, and should be used for embedded MSDE applications.
[Options] SAPWD="password " INSTANCENAME="myinstance"

To install MSDE, run the setup.exe install application.

Post reconfiguration
It is possible to reconfigure the authentication mode for an already installe database instance in the Control Panel (Administrative Tools and Service HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\myin Windows authentication, set this key to 1; for SQL authentication, set th the Control Panel (Administrative Tools and Services). Do you want to change the system administrator (sa user) passwo Login to the MSDE using the osql tool: Using Win authentication:
C:\> osql E S localhost\myinstance 1> use master 2> go 1> exec sp_password @old = null, @new = newpassword, @loginame = 's 2> go Password changed. 1>quit

Using SQL authentication:

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 6 of 12

C:\> osql U sa P password S localhost\myinstance 1> use master 2> go 1> exec sp_password @old = null, @new = newpassword, @loginame = 's 2> go Password changed. 1>quit

Configure the server:


Run the SQL Server network utility. Open a command prompt and type:
C:\> svrnetcn.exe

Enable the Named Pipes protocol and the TCP/IP protocol. Click on Pro configure the default port MSDE will be listening on if you want network ac

Configure the client:


Run the SQL Server client network utility. Open a command prompt and ty
C:\> cliconfg.exe

Enable the Named Pipes and the TCP/IP protocols. Click on Properties number you found with the svrnetcn.exe utility. Default is 1433. Add an alias for the Named Pipes and the TCP/IP under the Alias box applications to a specific configuration. The client just accesses the alias, a configuration.

Fire it up!
Lets start the MSDE. Open the Control Panel, the Administrative Tools and MSSQL$MYINSTANCE in the list. Right click it, and choose Start. Startu

How do I determine what version I am running?


OK, the MSDE should now be up and running. Lets test it. Run the osql too
C:\> osql E S localhost\myinstance 1: select @@VERSION 2: go 3: quit 8.00.194 8.00.384 8.00.534 8.00.760 MSDE MSDE MSDE MSDE 2000 2000 SP1 2000 SP2 2000 SP3

Create and delete a database

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 7 of 12

By default, the MSDE has four databases installed. These databases are:
z z z z

Master Contains all of the system meta-data, like login accounts, master.mdf, mastlog.ldf. Tempdb Contains work tables and temporary storage. All the data tempdb.mdf, templog.ldf. Model This is a model of all databases on the system. It acts as a modellog.ldf. Msdb Used for the SQL Server Agent to schedule jobs. Files: msdb

You should not use any of these databases for any application purposes. T are out of reach, simple as that. Create a new database to store your appl Let us create a database with the name Books. First of all, you must logi dbcreator privileges. Open the osql administration utility and login as syste
C:\> osql U sa P password S localhost\myinstance

Or
C:\> osql E S localhost\myinstance

Creating a simple database with the Model template:


1> use master 2:> go 1> CREATE DATABASE Books 2> go The CREATE DATABASE process is allocating 0.63 MB on disk 'Books'. The CREATE DATABASE process is allocating 0.49 MB on disk 'Books_log

Delete the Books database


1> use master 2:> go 1> DROP DATABASE Books 2> go Deleting database file 'C:\Program Files\Microsoft SQL Server\MSSQL$MYINSTANCE\Data\Books_log.LDF'. Deleting database file 'C:\Program Files\Microsoft SQL Server\MSSQL$MYINSTANCE\Data\Books.mdf'.

Creating a database specifying the file name


1> use master 2> go 1> CREATE DATABASE Books 2> ON 3> ( NAME = books_dat, 4> FILENAME = 'D:\Database\books.mdf' ) 5> go The CREATE DATABASE process is allocating 0.63 MB on disk 'books_dat

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 8 of 12

The CREATE DATABASE process is allocating 0.49 MB on disk 'Books_log

z z

NAME = Logical name used to specify the database in TSQL stateme FILENAME = Physical location of the database on the hard drive.

Creating a database specifying the filename and the size


1> use master 2> go 1> CREATE DATABASE Books 2> ON 3> ( NAME = books_dat, 4> FILENAME = 'D:\Database\books.mdf', 5> SIZE = 10, 6> MAXSIZE = 100, 7> FILEGROWTH = 5 ) 8> go The CREATE DATABASE process is allocating 10.00 MB on disk 'books_dat The CREATE DATABASE process is allocating 2.50 MB on disk 'Books_log

z z z z z

NAME = Logical name used to specify the database in TSQL stateme FILENAME = Physical location of the database on the hard drive. SIZE = Initial file size. MAXSIZE = The database maximum size. FILEGROWTH = Increments of the database file. The DB file will grow

Creating a database specifying the filename, size, and logfile


1> use master 2> go 1> CREATE DATABASE Books 2> ON 3> ( NAME = Books_dat, 4> FILENAME = 'D:\Database\books.mdf', 5> SIZE = 10, 6> MAXSIZE = 100, 7> FILEGROWTH = 5 ) 8> LOG ON 9> ( NAME = 'Books_log', 10> FILENAME = 'D:\Database\bookslog.ldf', 11> SIZE = 5, 12> MAXSIZE = 50, 13> FILEGROWTH = 2 ) 14> go The CREATE DATABASE process is allocating 10.00 MB on disk 'Books_dat The CREATE DATABASE process is allocating 5.00 MB on disk 'Books_log

z z z z z

NAME = Logical name used to specify the log and the database in TS FILENAME = Physical location of the log file and the database on the SIZE = Initial file size. MAXSIZE = The log and the database maximum size. FILEGROWTH = Increments of the log and the database file. The DB

How do I list all the databases on the system?


If you want to list all the databases in the instance, please open the osql u

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 9 of 12

C:\ >osql -E -S localhost\myinstance 1> use master 2> go 1> select name from sysdatabases 2> go name -----------------------------------master tempdb model msdb test Products (6 rows affected)

In this example, I have created two databases: test and Products.

How do I detach a database from the system?


To detach a database called larsinge from the system, please do the follow
1> exec sp_detach_db 'larsinge' 2> go

In this example, we detached a database called larsinge. The database c you want to do with the files.

How do I attach a database to the system?


Simply do this to connect a database called larsinge:
1> exec sp_attach_db @dbname = 'larsinge', 2> @filename1 = 'C:\Program Files\Microsoft SQL Server\MSSQL$LITBASE\Data\larsi 3> @filename2 = 'C:\Program Files\Microsoft SQL Server\MSSQL$LITBASE\Data\larsi 4> go

How do I list all tables in a database?


If you want to list all tables in an instance, please open the osql utility and
C:\ >osql -E -S localhost\myinstance 1> use Products 2> go 1> select name from sysobjects where type = 'U'

In this example, we list all tables in the Products database in the myinstan type to S if you want to list out all System tables.
C:\ >osql -E -S localhost\myinstance 1> use Products

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 10 of 12

2> go 1> select name from sysobjects where type = 'S'

Database users
Add and grant user access to the database.

Add a new user with SQL authentication:


This will add a new SQL login user lars with the password pass45 and se user, remember to grant access to the database and the tables for the use
1> use master 2> go 1> EXEC sp_addlogin 'lars', 'pass45', 'larsinge' 2> go New login created.

Grant access to the database:


1> use larsinge 2> go 1> EXEC sp_grantdbaccess 'lars' 2> go Granted database access to 'lars'. 1> grant all on table_name to lars 2> go

With Win authentication


Database name is larsinge, the Win auth user is TARGUS\testuser:
1> use larsinge 2> go 1> exec sp_grantdbaccess 'TARGUS\testuser' 2> go Granted database access to 'TARGUS\testuser'.

How to list all users and roles in a database?


Please open the osql utility, and do the following query to list all users in th
1> 2> 1> 2> use Products go select name from sysusers go

How to remove users from a database


This is how you revoke a user lars access to the database larsinge.

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 11 of 12

1> 2> 1> 2>

use larsinge go exec sp_revokedbaccess 'lars' go

Exit osql
1> quit

Lars-Inge Tnnessen
Click here to view Lars-Inge Tnnessen's online profile.

Other popular Database articles:


z z z z

A set of ADO classes - version 2.20


Simple database access using an ADO class.

ADO Connection Strings


A list of ODBC DSN Connection Strings.

CppSQLite - C++ Wrapper for SQLite


A C++ wrapper around the SQLite embedded database library.

CODBCRecordset class
CODBCRecordset class is intended to be full replacement of all ClassWizard generate

[Top]

Sign in to vo

Note: You must Sign in to post to this message board. FAQ Message sc V Msgs 1 to 25 of 86 (Total: 86) (Refresh) Subject Distribution Problem in java How can i use SQL Server2000 database without using SQL Server In java how can I grant user the swpro with system administrator permission/privilege How can I Using full SQLServer GUI tools with MSDE Re: Using full SQLServer GUI tools with MSDE MSDE runs from administrator account only [modified] Great Article msde not accepting paramters properly Change the MSDE Port

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

Hands on how to configure the Microsoft MSDE - The Code Project - Database

Page 12 of 12

Strange Problem with MSDE 2000 Over network user id Re: user id How i can enable TCI/IP protocol Re: How i can enable TCI/IP protocol Re: How i can enable TCI/IP protocol Localized string disabling workload governor Re: disabling workload governor create view dfg using MSDE with access where can I retain the password of 'sa' without uninstalling MSDE.? where can I retain the password of 'sa' without uninstalling MSDE.? Re: where can I retain the password of 'sa' without uninstalling MSDE.? Last Visit: 3:04 Thursday 24th May, 2007 General comment News / Info Question Answer Joke / Game

Updated: 14 Nov 2004

The Ultimate Toolbox ASP Alliance Developer Fusion Developersdex DevGuru Programmers He

http://www.codeproject.com/database/ConfigureMSDE.asp

5/24/2007

You might also like