Data Access Architecture

See Also      Tasks

Microsoft® Visual InterDev™ allows you great flexibility in designing Web applications with a database component. You can use any database supported by ActiveX® Data Objects (ADO) for which you have drivers, including Microsoft® SQL Server™, Microsoft® Access, Oracle, and others.

You can interact directly with the database or use views, stored procedures, and other database entities to manage the database. The database can be physically located on the same computer as your Web server or on a different computer. You can do all your database access using the Web server, or you can access the database directly from a client computer.

To prepare for the data access features of Visual InterDev, consider these concepts first:

Database Integration in Visual InterDev

Visual InterDev integrates a wide array of features to help you create Web applications with a database component:

Web Servers and Databases

In Web applications that access databases, two server-like functions are occurring: the Web server handles requests for pages and a database server or equivalent software handles database access. Although these two server functions are part of the same application, each functions separately.

You can configure Web servers and database servers in various ways, depending on how you want people to use the database server, what the target audience is for your Web application, and how the application relates to other applications in your business. The following configuration options are possible:

Using the Web server as a gateway to the database is the most common strategy, because it gives Web applications the widest reach — the server does the database work, so it doesn't matter what type of browser the user has. Server-side database access is therefore a good choice for public Internet sites, where users might access the site with any browser.

Client-side access, on the other hand, can provide a richer user experience that emphasizes performance, because the browser can manage data sets independently from the Web server. However, client-side access requires Internet Explorer DHTML as a browser, and also that the database be accessible via specific database drivers. Client-side database access is therefore most practical in intranet sites, such as a corporate Web site, where users access the site using a standard browser with predictable features.

For information about Web server and database server security, see Security.

Data Connections

To use a database, you add a data connection to your Visual InterDev project, which tells it how to access the database. Typically, a data connection includes information such as:

You can add as many data connections to your project as you need. For example, if your application requires access to two different databases, you would add two data connections. For details about how to add a data connection, see Connecting to a Database.

Creating Connections

When you are creating a data connection, Visual InterDev reads connection information from a DSN (data source name) on your computer. Your computer can provide the DSN information in either a file DSN (stored in a .dsn file) or a machine or system DSN (stored in the Windows® registry of your computer).

File Data Source Name

In the case of a file DSN, Visual InterDev reads the connection information from the DSN and extracts the connection string. It then adds a connection node to your project's data environment.

The connection string extracted from the DSN is stored in your Web project in a binary file called DataEnvironment.asa. This is referred to as a "DSN-less" connection, because the Web project no longer needs the DSN to establish the connection. From then on, Visual InterDev can simply read the connection information from the binary file as needed.

Machine Data Source Name

In the case of using a machine or system DSN, a connection string is not used. Instead, you will have to recreate the DSN on each development machine as well as the Web server.

ODBC Drivers

At run time, the server must have the appropriate ODBC driver to make the connection to the data source. By default, ODBC drivers are installed on both your development computer and your server when you install Visual InterDev. However, if you deploy your applications to other servers, you must make sure that those servers also have the correct ODBC drivers.

Security with Data Connections

Generally, when you are creating an application, you want to have the widest possible range of privileges so you can manipulate the database and data as needed. However, when users access the data at run time, you want to limit them to the minimum privileges required to run the application.

Your first task is to create user profiles on the database. For example, you might create an administrator-level user profile for yourself to use during development. You can also create a user profile with privileges appropriate for users of your application. If the database server is on a different computer than the Web server, you must also make sure that the correct user profiles have been defined at the operating system level. For more information, see Security.

Later, when you create a data connection, you can specify both design-time and run-time authorization. Design-time authorization is the user name and password you use when developing the application. Run-time authorization is the user name and password that Visual InterDev will use when connecting to the database while the application is running.

When specifying design-time authorization, you choose how secure your authorization is. For maximum security, you can choose to be prompted for a password each time you connect to the database. If you are not as concerned about security, you can choose not to be prompted. In that case, Visual InterDev encrypts your password and stores it in the project.

When you specify run-time authorization, you do not have this choice: you cannot prompt users for a password, because the prompting would necessarily have to occur on the Web server. Therefore, you must include the password with the user name. The password is encrypted and stored in the project so it can be passed to the database each time a user connects to the database when the application is running.

Database Management

In addition to helping you create Web pages that are linked to databases, Visual InterDev allows you to manage databases while directly connected to them at design time. Depending on the features of your database and your access privileges, you can use Visual InterDev tools to add, remove, or modify:

Note   Features that allow you to make structural edits to databases are available only in the Enterprise Edition of Microsoft® Visual Studio™.

Managing databases is a separate task from adding database functionality to a Web application. Therefore, to manage databases in Visual InterDev, you create a database project. To help you perform various database management tasks, a database project in Visual InterDev provides the following tools:

For more information about the tools available for managing a database, see Introducing Microsoft Visual Database Tools.