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 Tønnessen.

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

ANNOUNCEMENTS Search Articles G

Vista API competition Print Broken Article? Bookmark Discuss Send to a friend
$10,000 in prizes
Vista Mobile comp:
Win a Samsung UMPC Introduction
Vista Secure API
comp: Win a Laptop! This article describes how to configure the Microsoft MSDE database engine
VB6 Interop Comp
Win an Xbox Elite! z What is MSDE?
Monthly Competition z Limitations
z What you get
z How to install and configure the MSDE
z Arguments to the setup.exe file
z Using the “setup.ini” file
z Post reconfiguration
z Configure the server
z Configure the client
z Fire it up!
z How do I determine what version I am running?
z Create and delete a database
z How do I list all the databases on the system?
z How do I detach a database from the system?
z How do I attach a database to the system?
z How do I list all tables in a database?
z Database users
z Add a new user with SQL authentication
z With Win authentication
z How to list all users and roles in a database
z How to remove users from a database
z 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 don’t get:

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

What you get

This is what you get:

z Maximum number of processors: 2 in NT/Win2000/XP/2003, 1 in Win


z Maximum physical memory: 2 GB.
z Maximum user connections: 5 before the work load governor will lim
z Maximum data storage: 2 GB.
z Desktop embedded or network access.
z Leading SQL database performance.
z It’s 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 Using the “setup.ini” file.


z Post reconfiguration.

The four different running modes are:

z Windows authentication without network access.


z Windows authentication with network access.
z Mixed Windows and SQL mode authentication without network acces
z 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!

Let’s 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. Let’s test it. Run the osql too

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

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 Master – Contains all of the system meta-data, like login accounts,


master.mdf, mastlog.ldf.
z Tempdb – Contains work tables and temporary storage. All the data
tempdb.mdf, templog.ldf.
z Model – This is a model of all databases on the system. It acts as a
modellog.ldf.
z 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 NAME = Logical name used to specify the database in TSQL stateme


z 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 NAME = Logical name used to specify the database in TSQL stateme


z FILENAME = Physical location of the database on the hard drive.
z SIZE = Initial file size.
z MAXSIZE = The database maximum size.
z 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 NAME = Logical name used to specify the log and the database in TS
z FILENAME = Physical location of the log file and the database on the
z SIZE = Initial file size.
z MAXSIZE = The log and the database maximum size.
z 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> 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’.

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> use larsinge


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

Exit osql

1> quit

Lars-Inge Tønnessen

Click here to view Lars-Inge Tønnessen's online profile.

Other popular Database articles:

z A set of ADO classes - version 2.20


Simple database access using an ADO class.
z ADO Connection Strings
A list of ODBC DSN Connection Strings.
z CppSQLite - C++ Wrapper for SQLite
A C++ wrapper around the SQLite embedded database library.
z 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

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