Solved

dreamweaver  MX - cant connect to mysql

Posted on 2009-04-13
17
254 Views
Last Modified: 2012-05-06
I have managed to connect using a php test script that resides in the root folder , but when I try and connect to MYSQL from Dreamweaver using the database Mysql connection option, I add the settings which I believe to be correct and then test or apply and I get returned an "Un-identified error has occurred". Please help.
0
Comment
Question by:jezskill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 8
17 Comments
 
LVL 19

Expert Comment

by:v2Media
ID: 24134769
Does DW successfully create the connection file? You'll find it in a folder called 'connections' and the file should have the same name that you defined when setting up the MySQL connection in DW.
0
 
LVL 1

Author Comment

by:jezskill
ID: 24141489
It has created the folder but the connection file doesnt exist within it.
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24143485
Try saving the file manually in the "Connections" folder. Call it "conn.php" and paste the following contents in it, then enter the database values and save.


<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_conn = "localhost";
$database_conn = "databaseName";
$username_conn = "username";
$password_conn = "password";
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR); 
?>

Open in new window

0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:jezskill
ID: 24161792
Now when I open Dreamweaver, it shows theres a connection in right hand task pane, but there are no tables when I drill down, if I right-click on the connection , choose edit connection and choose test connection , the unidentified error pops up again.
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24163184
OK, so DW can't connect to MySQL. I suspect the MySQL service isn't running or MySQL isn't configured properly. Where is the MySQL svr that you're trying to connect to, local on your computer/network or external on the web?

If local, can you use another app such phpMyAdmin to connect and manage the databases? If external on the web, is the external server configured to accept connections from your IP?
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24163225
Be sure that whichever MySQL server your connecting to has an appropriate host set for the database to accept connections from. Try using a wildcard '%' host as a last resort.
0
 
LVL 1

Author Comment

by:jezskill
ID: 24184006
MySQL is local on my machine, I am able to manipulate databases, create table and edit date using MYSQL Administrator application.

The hostname set is the local machine name i.e. jez-notebook.

Just out of interest , I have noticed that all php script tags visible in Dreamweaver appear to be bright red colour as if you may have if the code was iilegal or not known. Is this correct?
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24189483
ok - so can you check whether you have a valid host for the user associated with the database? Also, do you have php and iis or apache installed?

The red tags in DW code view is the correct colour.
0
 
LVL 1

Author Comment

by:jezskill
ID: 24197471
sorry please could elaborate as to what a valid host is, I have php installed and also Apache on port 8080 as IIS is installed also.
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24200015
MySQL has 2 entities involved in authentication before a connection to a database is allowed, user and host. Host is the IP address of the computer/server. The username/password/host that is listed in MySQL permissions to a database must match the user/pass/host doing the connecting.

If you don't understand at this point - you need to read more MySQL Administrator documentation. Read the help files for adding a host to a user associated to a database. http://www.techotopia.com/index.php/The_MySQL_Administrator_Tool
0
 
LVL 1

Author Comment

by:jezskill
ID: 24202536
Ok, yes the username/password/host in mysql permissions does match the user/password/host doing the conecting.
0
 
LVL 1

Author Comment

by:jezskill
ID: 24231816
Just windering what I should try next?
thanks
0
 
LVL 1

Author Comment

by:jezskill
ID: 24233266
I have deduced that I cant prove that I am connecting to MYSQL using a php script, how can I prove this. What Can I add to the script to prove the connection?

thanks
0
 
LVL 19

Accepted Solution

by:
v2Media earned 500 total points
ID: 24234143
Use some debug code - save your original DW db connection file as something else, then use the one below. Test a page on the site that uses a db connection and the javascript alert window will tell you if the script has connected successfully or not.
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_conn = "localhost";
$database_conn = "databaseName";
$username_conn = "username";
$password_conn = "password";
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
//debug db conn
if($conn) {
?>
<script type="text/javascript" language="javascript">
   alert('Connection to <?php echo $database_conn; ?> OK.');
</script>
<?php } else { ?>
<script type="text/javascript" language="javascript">
   alert('Connection to <?php echo $database_conn; ?> failed.');
</script>
<?php } ?>

Open in new window

0
 
LVL 1

Author Comment

by:jezskill
ID: 24234981
Ok, that worked , it says connected Ok, so am I to asume its a dreamweaver issue? PHP and Apache seem to be configured ok? just to confirm my dreamweaver site config set up is as follows;
Local Info
Local Root folder C:\InetPub\wwwroot
HTTP Address http://localhost:8080/

Testing Server
Testing server folder c:\inetpub\wwwroot\
url prefix    http://localhost/

In fact when I looked at this I went straight to edit sites and changed the url prefix to add my port 8080 on the end and now the connection works. Thank god , I have read that people get stuck on this for days on end. thanks for the assistance.
0
 
LVL 1

Author Closing Comment

by:jezskill
ID: 31569471
It seems that are many reasons why dreamweaver throws up an un-identified error which doesnt prove to very informative. Its just a case of systematic trial and error. I thought it might be do with Apache and PHP but I have read over 20 web postings on this , and I was quietly confident that i had it set up right., thanks again.
0
 
LVL 19

Expert Comment

by:v2Media
ID: 24235173
You should have mentioned the 8080 port config at the beginning...

It's safe to leave the http address empty in the local definition, ignore the warnings; just be sure to use doc relative links, not site relative. All you need there is the local root folder. For the testing site definition, when you're using inetpub/wwwroot, create a parent folder for each project for eg inetpub/wwwroot/siteOne/. Reason being, DW won't let you define another site in the same folder.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question