first you need to define a site within Dreamweaver. See this tutorial for details:
http://www.webassist.com/tutorials/Define-a-dynamic-site-in-CS5
The undefined error on creating the database connection is related to problems in the site definition.
once the site is defined in dreamweaver, you can create the database connection:
http://www.webassist.com/tutorials/Create-a-PHP-database-connection