Click here to Skip to main content
15,861,340 members
Articles / Database Development / SQL Server
Article

Hands on how to configure the Microsoft MSDE

Rate me:
Please Sign up or sign in to vote.
4.87/5 (134 votes)
14 Nov 200411 min read 605.1K   226   88
An article on how to setup and configure the MSFT MSDE 2000.

Introduction

This article describes how to configure the Microsoft MSDE database engine. Below you will find an overview of the topics.

What is MSDE?

MSDE is a limited version of the Microsoft SQL Server. In short, it is the Microsoft SQL Server 2000 database engine without any of the fancy UI tools, and with some limitations in the database size and the number of connections. The MSDE database is free, and can be distributed embedded in your own applications or as a small stand alone SQL server. It is ideal for small websites and small businesses with less than 25 simultaneous users. The database is limited to 2 GB of data storage space, but you can easily upgrade it to a full Microsoft SQL Server without any limitations. Among the choices are, a standard edition or an enterprise edition. An MSDE database is a good and affordable starting point for any business, organization or even home solutions. The database does not have to be installed on the hard drive on the deployment computer, but it could be running from a CD-ROM.

Limitations

There are some limitations to a MSDE database. You don’t get:

  • 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:

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

How to install and configure the MSDE

The MSDE can be downloaded from the Microsoft web site for free. Download the archive and uncompress it to a folder on your hard drive. There are four different ways to run the MSDE depending on how you want to access the database. They are all listed below.

You can configure the MSDE in three different ways:

  • Arguments to the setup.exe file.
  • Using the “setup.ini” file.
  • Post reconfiguration.

The four different running modes are:

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

Please use Windows authentication whenever possible. SQL mode will send the login and the password information over the network in plain text. This means it can be sniffed by intruders or hackers. Windows authentication uses SSPI which you can read more about on these web pages MSDN [1], and MSDN [2]. A default installation will disable the network access and uses the Windows authentication mode.

Before you start the installation of the MSDE, disable Norton Antivirus and the Internet Security Pack. You will enable it after the installation has completed. Norton Antivirus will not let you install the MSDE successfully, when enabled.

In all of our examples, we will be using “password” for the system administrator, and “myinstance” for the database instance.

Arguments to the setup.exe file

You can run configure the MSDE by giving arguments to the setup.exe file on a command prompt.

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 want to send the username and password in plain text over the network. Only Windows applications and .NET applications can access the database. The application uses automatically the 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 we want to access the database from both Windows applications and Java applications over a network. The username and password will be sent over the network in plain text.

C:\...MSDE\>Setup.exe DISABLENETWORKPROTOCOLS=0 
      SAPWD="password " INSTANCENAME="myinstance" SECURITYMODE=SQL

Mixed Windows and SQL mode authentication without network access.

Example 3 (Local Java and Win access only):

In this example, we will not be granting access from the network. Only local applications can access the database. We will be using mixed mode authentication for Java applications.

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

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 also only grant Win authentication access. This is the 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 a pre configured setup file. Please remember that anyone with read access to this file can see the system administrator password if this is an issue. The file looks like this:

[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 want to access the database from both Windows applications and Java applications over a network. The username and password will be sent over the network in plain text.

[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 want to send the username and password in plain text over the network. Only Windows applications and .NET applications can access the database. The application uses automatically the 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.

Mixed Windows and SQL mode authentication without network access.

Example 3 (Local Java and Win access only):

In this example, we will not be granting access from the network. Only local applications can access the database. We will be using 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 also only grant Win authentication access. This is the 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 installed instance of the MSDE, through the registry. Stop the database instance in the Control Panel (“Administrative Tools” and “Services”). Open the “regedt32.exe”, and locate the “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\myinstance\MSSQLServer” and the key “LoginMode”. For Windows authentication, set this key to “1”; for SQL authentication, set this key to “0” (or “2”?). Restart the database instance in the Control Panel (“Administrative Tools” and “Services”).

Do you want to change the system administrator (sa user) password?

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 = 'sa'
2> go
Password changed.
1>quit

Using SQL authentication:

C:\> osql –U sa –P password –S localhost\myinstance
1> use master
2> go
1> exec sp_password @old = null, @new = ‘newpassword’, @loginame = 'sa'
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 “Properties” on the “TCP/IP” protocol. Here, you will configure the default port MSDE will be listening on if you want network access. Default is 1433.

Configure the client:

Run the SQL Server client network utility. Open a command prompt and type:

C:\> cliconfg.exe

Enable the “Named Pipes” and the “TCP/IP” protocols. Click on “Properties” on the “TCP/IP” protocol. Here you configure the port 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. You will use an alias if you do not want to configure all applications to a specific configuration. The client just accesses the alias, and the client utility will map the request to the right configuration.

Fire it up!

Let’s start the MSDE. Open the Control Panel, the Administrative Tools and the “Services” utility. Find the instance “MSSQL$MYINSTANCE” in the list. Right click it, and choose “Start”. Startup type should be “Automatic”.

How do I determine what version I am running?

OK, the MSDE should now be up and running. Let’s test it. Run the osql tool.

C:\> osql –E –S localhost\myinstance
1: select @@VERSION
2: go
3: quit

8.00.194 - MSDE 2000
8.00.384 - MSDE 2000 SP1
8.00.534 - MSDE 2000 SP2
8.00.760 - MSDE 2000 SP3

Create and delete a database

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

  • Master – Contains all of the system meta-data, like login accounts, settings, and the location of the database files etc. Files: master.mdf, mastlog.ldf.
  • Tempdb – Contains work tables and temporary storage. All the data in this database will be deleted on disconnect. Files: tempdb.mdf, templog.ldf.
  • Model – This is a model of all databases on the system. It acts as a template for new databases. Files: model.mdl, modellog.ldf.
  • Msdb – Used for the SQL Server Agent to schedule jobs. Files: msdbdata.mdf, msdblog.ldf.

You should not use any of these databases for any application purposes. They are holy land as far as the applications know it. They are out of reach, simple as that. Create a new database to store your application data.

Let us create a database with the name “Books”. First of all, you must login as a system administrator (sa) or as a user with dbcreator privileges. Open the osql administration utility and login as system administrator.

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'.
The CREATE DATABASE process is allocating 0.49 MB on disk 'Books_log'.
  • NAME = Logical name used to specify the database in TSQL statements.
  • 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'.
  • NAME = Logical name used to specify the database in TSQL statements.
  • 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 with this size in MBs.

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'.
  • NAME = Logical name used to specify the log and the database in TSQL statements.
  • FILENAME = Physical location of the log file and the database on the hard drive.
  • SIZE = Initial file size.
  • MAXSIZE = The log and the database maximum size.
  • FILEGROWTH = Increments of the log and the database file. The DB file will grow with this size in MBs.

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 utility and do the following query:

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 following:

1> exec sp_detach_db 'larsinge'
2> go

In this example, we detached a database called “larsinge”. The database can now be moved, backed-up, or you can do whatever 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\larsinge.mdf',
3> @filename2 = 
      'C:\Program Files\Microsoft SQL Server\MSSQL$LITBASE\Data\larsinge_log.LDF'
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 do the following query:

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 myinstance. Type ‘U’ means “User Table”. Please try to change type to “S” if you want to list out all System tables.

C:\ >osql -E -S localhost\myinstance
1> use Products
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 set the default database to ‘larsinge’. After creating the user, remember to grant access to the database and the tables for the user.

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 the Products database:

1> use Products
2> go
1> select name from sysusers
2> go

How to remove users from a database

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

1> use larsinge
2> go
1> exec sp_revokedbaccess 'lars'
2> go

Exit osql

1> quit

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Norway Norway
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralThanks for the FAQ list Pin
S Chong21-Apr-10 17:34
S Chong21-Apr-10 17:34 
QuestionCan you update the link? Pin
Joe Pool9-Apr-08 6:04
Joe Pool9-Apr-08 6:04 
GeneralDistribution Problem in java Pin
shahidalikhan30-Sep-06 8:15
shahidalikhan30-Sep-06 8:15 
QuestionHow can i use SQL Server2000 database without using SQL Server In java Pin
shahidalikhan30-Sep-06 8:07
shahidalikhan30-Sep-06 8:07 
Questionhow can I grant user the swpro with system administrator permission/privilege?? Pin
sunnycode23-Aug-06 7:09
sunnycode23-Aug-06 7:09 
QuestionHow can I Pin
MoNa MoOn28-Jun-06 21:32
MoNa MoOn28-Jun-06 21:32 
GeneralUsing full SQLServer GUI tools with MSDE Pin
Fred_Smith26-Jun-06 9:07
Fred_Smith26-Jun-06 9:07 
GeneralRe: Using full SQLServer GUI tools with MSDE Pin
Lars-Inge Tønnessen26-Jun-06 10:48
Lars-Inge Tønnessen26-Jun-06 10:48 
GeneralMSDE runs from administrator account only [modified] Pin
maksim.simkin6-Jun-06 3:37
maksim.simkin6-Jun-06 3:37 
GeneralGreat Article Pin
iamnoguru6-May-06 3:53
iamnoguru6-May-06 3:53 
Generalmsde not accepting paramters properly Pin
Lalitesh Kumar20-Apr-06 4:33
Lalitesh Kumar20-Apr-06 4:33 
GeneralChange the MSDE Port Pin
lakshmi patil10-Apr-06 0:24
lakshmi patil10-Apr-06 0:24 
GeneralStrange Problem with MSDE 2000 Over network Pin
Vipul \3-Nov-05 19:29
Vipul \3-Nov-05 19:29 
Generaluser id Pin
Anonymous6-Oct-05 14:20
Anonymous6-Oct-05 14:20 
GeneralRe: user id Pin
justus_s10-Aug-06 1:14
justus_s10-Aug-06 1:14 
QuestionHow i can enable TCI/IP protocol Pin
Prafulgoyal19-Sep-05 23:25
Prafulgoyal19-Sep-05 23:25 
AnswerRe: How i can enable TCI/IP protocol Pin
Andreas_Maier28-Dec-05 7:56
Andreas_Maier28-Dec-05 7:56 
GeneralRe: How i can enable TCI/IP protocol Pin
ChinHim21-Nov-06 14:00
ChinHim21-Nov-06 14:00 
GeneralLocalized string Pin
Member 19348738-Sep-05 4:30
Member 19348738-Sep-05 4:30 
Generaldisabling workload governor Pin
Anonymous5-Sep-05 0:58
Anonymous5-Sep-05 0:58 
GeneralRe: disabling workload governor Pin
Lars-Inge5-Sep-05 2:08
sussLars-Inge5-Sep-05 2:08 
Generalcreate view Pin
Anonymous29-Aug-05 0:07
Anonymous29-Aug-05 0:07 
Generaldfg Pin
Anonymous29-Aug-05 0:03
Anonymous29-Aug-05 0:03 
Generalusing MSDE with access Pin
ankur6ue25-Aug-05 6:44
ankur6ue25-Aug-05 6:44 
Questionwhere can I retain the password of 'sa' without uninstalling MSDE.? Pin
pubududilena5-Aug-05 1:15
pubududilena5-Aug-05 1:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.