Connecting to a database
This section describes how to connect to a database when developing a JSP application in Dreamweaver.
The section assumes a JSP application server is running on a local or remote computer. For more information, see Setting Up a Web Application.
Before you can connect to a database, you must obtain a JDBC driver for your database. For more information, see Obtaining a JDBC driver for your database.
After you install the database driver, you can connect to the database through it. For instructions, see Creating a database connection for JSP.
Obtaining a JDBC driver for your database
Make sure you have a JDBC driver for your database before you try to create a database connection. Some common JDBC drivers include the Oracle Thin JDBC driver, the Oracle Java Driver, and the i-net JDBC drivers for Microsoft SQL Server.
Database system vendors such as Oracle often include drivers with their systems. You can also purchase drivers from third-party vendors. For example, you can obtain a JDBC driver for Microsoft SQL Server from i-net software at www.inetsoftware.de/products/jdbc/.
Sun also provides a searchable database of JDBC drivers and their vendors on its website at http://developers.sun.com/product/jdbc/drivers.
Once you have a JDBC driver for your database, you can create a database connection. For instructions, see Creating a database connection for JSP.
- Installing the Sun JDBC-ODBC Bridge driver
- Communicating with the database
Creating a database connection for JSP
After you install an appropriate JDBC driver for your database on the computer running your application server (see Obtaining a JDBC driver for your database), you can create a database connection in Dreamweaver.
To create a database connection for JSP:
- Open a JSP page in Dreamweaver, then open the Databases panel (Window > Databases).
Dreamweaver displays the connections defined for the site.
- Click the Plus (+) button and select your driver from the pop-up menu.
If your driver is not listed, select Custom JDBC Connection.
A connection dialog box appears.
- Enter the connection parameters in the connection dialog box.
For more information, see JDBC connection parameters.
- Specify the location of the JDBC driver you want to use.
- If your JDBC driver is installed on the same computer as Dreamweaver, select the Using Driver On This Machine option.
- If your JDBC driver is not installed on the same computer as Dreamweaver, select the Using Driver On Testing Server option.
Macintosh users can ignore this step because all database connections use the application server.
- Click Test.
Dreamweaver attempts to connect to the database. If the connection fails, double-check the the connection parameters. If the connection still fails, check the settings for the folder Dreamweaver uses to process dynamic pages (see Specifying where dynamic pages can be processed).
- Click OK.
The new connection appears in the Databases panel.
- Troubleshooting Database Connections