Basic Principles of Data Source Design in Dreamweaver
I will show you the powerfull of Adobe Dreamweaver. Like other IDE, Adobe Dreamweaver is powerful tool to build Web Application. So, you’ve been building static Web sites for a while now and you’ve decided to take the plunge into data-driven Web work. Your main question probably is “Where do I start?” The short answer: here. A slightly longer answerabout 500 pagesfollows….
Before you begin crafting dynamic Web sites and adding “developer” to your designer credentials, it’s best to spend some time learning the fundamentals. Build-them-today-and-use-them-tomorrow applications, this post the one that followsis more theoretical. To get the most out of this post, you have to understand both theory and practice.
Connecting to Data Sources
With a well-designed data source at the ready, you’re prepared to establish a connection to it from your Web application. You can achieve a connection in several ways, depending on the application server in use. Typically, application servers offer several alternative routes to establishing a connection. One method might be easier to set up but not quite as efficient, whereas another might be more difficult to create but more robust. It’s good to know what the options are so that you can decide which type of connection is best in a given situation.
Connecting to a MySQL Data Source for PHP
As noted earlier, MySQL is a server-based data source. Dreamweaver provides a direct method for creating a connection to a MySQL data source. Once the connection is established, you’ll be able to refer to the connection for all the relevant applications.
Inserting a Connection
Connections are created and displayed in Dreamweaver’s Databases panel. Before you can create a connection, MySQL must be running, and you should have a username and password established.
To create a connection, follow these steps:
- From the Databases panel, choose Add (+) and select MySQL Connection from the drop-down list.
- In the MySQL Connections dialog displayed, enter a name for your connection.
Enter Recipes in the Connection Name field. - Insert the server address hosting MySQL.
The MySQL server address is either an IP address or, if the server is located on your development system, localhost. - Enter your username and password in their respective fields.
- Specify the database.
Choose Select and click Recipes in the Select Databases dialog. Click OK to confirm your choice and close that dialog. - Select Test to verify that the connection is working.
- After the connection is confirmed, click OK to close the dialog and create the connection file.
The newly created connection is displayed in the Databases panel. Expand the main connection node to reveal the available tables. The actual connection file is stored in the Connections folder and can be opened and examined in Dreamweaver. Dreamweaver writes a standard PHP file, like this one:
< ?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_Recipes = "localhost";
$database_Recipes = "recipes";
$username_Recipes = "root";
$password_Recipes = "mypassword";
$Recipes = mysql_pconnect($hostname_Recipes, $username_Recipes,
$password_Recipes) or trigger_error(mysql_error(),E_USER_ERROR);
?>
When you create a recordset in Dreamweaver, the connection file is included through the use of a require_once() function. This function is written into your PHP page at the top above the < html> tag, like the following code:
< ?php require_once('Connections/Recipes.php'); ?>
The connection file is considered a dependent file by Dreamweaver. As such, it can be transferred automatically from the local to remote site with your application page when using Dreamweaver’s built-in FTP feature to transfer files. Dreamweaver asks whether you’d like to transfer dependent files as well as the primary file. Answering yes ensures that the connection file is uploaded as well as additional system files necessary for the connection to be completed.
Popularity: 4% [?]




































