• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 700
  • Last Modified:

How can I connect to my Database via GoDaddy?

Hi,
Well I am using Dreamweaver and although there are a lot of discussions regarding this topic I have yet to figure out what my issue is.  I cannot connect to my database via the Dreamweaver wizard.  Can I just bypass the wizard and hand code my own connection file?  I am using PHP/MySQL.  I can connect to the FTP  I have spent 2 days on this.  I get code error 404.  There is no testing server running.

Please help!
0
napsternova
Asked:
napsternova
  • 9
  • 8
  • 7
  • +1
2 Solutions
 
Jason C. LevineNo oneCommented:
Hi napsternova,

You can create your own connection file but DW will probably not recognize it and let you use it in conjunction with its wizards.  If you are a hand-coder and not using the wizards, then go for it.

Otherwise, you need to work with GoDaddy support to fix the issue.  It is usually caused by some incorrect setting (either you have the name of the server wrong or the wrong login credentials OR the database user is restricted from accessing the database in some way -- domain name or IP address are common).   This is a fairly endemic problem with GoDaddy but I've seen it fall both ways.
0
 
chilternPCCommented:
sometimes where the connection says "local server" i.e. 127.0.0.1  or what ever it is
find out the actual IP address of where the database is  and use that - or if you are using the actual IP address try the local 127.0.0.1 one.....
0
 
Dave BaldwinFixer of ProblemsCommented:
Godaddy MySQL connections are strictly Local unless you set it up otherwise.  I have one setup for remote connections and it works from this computer.  It uses the standard connection setup for PHP/MySQL.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
napsternovaDeveloperAuthor Commented:
Dave,
So you are able to use Dreamweaver?  I have never had this type of issue before.  I created a new database and I have it set up to allow remote access.  I like the simplicity of drag/drop dynamic fields and text but without a connection I cannot create a recordset.
0
 
Dave BaldwinFixer of ProblemsCommented:
I don't use Dreamweaver but I occasionally help fix it's code.  Below is my generic PHP/MySQL connection page that I just used to connect to my Godaddy MySQL database.  You can run this from a web server but I don't know if it will work under Dreamweaver since Dreamweaver isn't a real browser or web server.
<?php 
// DB configuration
//$dbhost = "localhost";    // Your database server
$dbhost = "yourserver";    // Your database server
$dbuser = "yourusername";      // Your db username
$dbpass = "yourpassword";      // Your db password
$dbname = "yourdbname";      // Your database name
$dbtable = "yourtable";  // the table we're using

//mysql_connect('localhost', 'mysql_user', 'mysql_password');
$dbh = mysql_pconnect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Generic dbCheck</title>
<meta name="GENERATOR" content="HTMLKit">
<meta name="author" content="Dave Baldwin" />
</head>
<body>
<?php 
echo "$dbhost <br>";
?>
<table border="1" cellpadding="1" cellspacing="1" width="100%">
<caption><font style="font-weight: bold; font-size: 18pt; line-height: 24pt;">Generic dbCheck</font></caption>
<tbody>
<tr bgcolor="#ffffff">
<?php 
// Formulate Query
// For more examples, see mysql_real_escape_string()
$result = mysql_query("SELECT * FROM $dbtable LIMIT 10");
if (!$result) {
   echo 'Could not run query: ' . mysql_error();
   exit;
}

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo '<tr class="locmus">';
echo '<td>'.$row[0].'</td>';
echo '<td>'.$row[1].'</td>';
echo '<td>'.$row[2].'</td>';
//echo '<td>'.$row[3].'</td>';
//echo '<td>'.$row[4].'</td>';
//echo '<td>'.$row[5].'</td>';
//echo '<td>'.$row[6].'</td>';
echo '</td></tr>';
}
?>
</tbody> 
</table>

</body>
</html>

Open in new window

0
 
Jason C. LevineNo oneCommented:
The above will "work" in Dreamweaver in the sense that it's perfectly valid PHP and will allow you to hand-code stuff.  But if you want to work with DW wizards, you have to let DW write its own code.

Dave has it right with http:#a33448903 but you may need to contact GoDaddy support to make sure that you are indeed set up for remote access and that the user is not limited to a specific domain or ip range.

0
 
napsternovaDeveloperAuthor Commented:
So since I cannot use Dreamweaver for its intended purpose, is it easy enough to build the site locally and then upload the whole thin and change the database connection parameters?  If this were my site I would find a new host, I've spent 2 days trying to get Dreamweaver to work.  Any ideas for building a contanct management system?
0
 
chilternPCCommented:
buy one off the shelf or get an open source one for free...
they all come working out of the box

list of open source here...
http://php.opensourcecms.com/scripts/show.php?pagenumber=2&catid=all
0
 
Jason C. LevineNo oneCommented:
>> So since I cannot use Dreamweaver for its intended purpose

Sure you can.  All you need to do here is talk to GoDaddy support and get them to help you with the connection parameters.  Better yet, host elsewhere...there's plenty of low-cost, high-feature hosting to choose from out there.
0
 
napsternovaDeveloperAuthor Commented:
jason1178,
yeah I talked to them 3 times.  They all seemed interested in helping but when it was all said and done I am here looking for answers.  I keep getting the testing server not active or installed, I forget which.

I would switch but it isn't my site.
0
 
Jason C. LevineNo oneCommented:
Can you connect to the DB through a browser (i.e. use phpMyAdmin)?
0
 
Dave BaldwinFixer of ProblemsCommented:
This is a bit of a puzzle to me because I used the code I posted above to connect to my MySQL database on my Godaddy Windows IIS7 hosting from this computer running Windows 2000 with IIS5.0 and PHP 5.2.5.  I also use similar code for a customer running on Godaddy Linux hosting.  So the connection details are the same as any other MySQL setup if you have set it up for remote access which is just a checkbox on the setup request.  You have to get the 'connection details' from the database page in the Hosting Control panel.  Other than that, Dreamweaver really shouldn't have a problem with it.  It's plain vanilla stuff.

Which hosting, Linux or Windows, are you using?  And did you try the test page I posted above?
0
 
chilternPCCommented:
what version of dreamweaver do you have?
0
 
napsternovaDeveloperAuthor Commented:
jason - yes I can access phpmyadmin
dave - hosting is Linux, what should I save the file as and then where should it be saved.  This site has a bunch of aliases so I am uploading my site to an alias folder.
chilternPC - Dreamweaver CS4
Thanks all  
0
 
napsternovaDeveloperAuthor Commented:
Dave - OK that file works, I am starting to get really confused.  So do I need to hand code my forms, logins and reports?  
0
 
Dave BaldwinFixer of ProblemsCommented:
That's a possibility but since I don't have or use Dreamweaver, I suggest you work it out with the others.  Maybe they can tell you how to get Dreamweaver to cooperate since we now know that the connection works.
0
 
Jason C. LevineNo oneCommented:
Try this...

From Dreamweaver, open the FTP log (Windows | Results | FTP log)

Once the FTP log is open, do Site | Advanced | Remove Connection Scripts

You should see some activity in the FTP log that shows a number of files being checked and then removed.

After that's complete, edit your site definition and make sure the testing server settings and remote server settings are correct.  For simplicity, set both of them to be the same (i.e. point the testing server at GoDaddy) and make sure the Host Directory the remote and testing servers are the public site root.

Then switch to the Databases panel and redefine the Connection.  You should see activity in the FTP log as new files are uploaded to GoDaddy.  Open a new page and attempt to create a recordset...
0
 
napsternovaDeveloperAuthor Commented:
Dave - If I may ask, what do you use?  Seems like Dreamweaver writes extra code that Godaddy doesn't like.  That's fine if the code is cleaner and faster, I can adapt.  Too bad this little job is going into week 2.
0
 
napsternovaDeveloperAuthor Commented:
jason - will do, thanks
0
 
Dave BaldwinFixer of ProblemsCommented:
I hand code everything in HTML-Kit.  You saw the code I actually use.  Many, many times.  Well, what follows the connection gets a lot more complicated but that's the way it starts.  I wonder about what Dreamweaver is writing because the code I posted is like the basic code form the PHP demo page.  There are two other ways of doing it.  Maybe Dreamweaver is using one of them.  With your login info removed, can you post the code it's generating for you?
0
 
Jason C. LevineNo oneCommented:
Dreamweaver does a couple of things that it really shouldn't.  First off, a connection in DW is simple:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_connNAME = "mysql.domain.com";
$database_connNAME = "database";
$username_connNAME = "username";
$password_connNAME = "password";
$connNAME = mysql_pconnect($hostname_connNAME, $username_connNAME, $password_connNAME) or die(mysql_error());
?>

That's the include file called from every page.  Nothing unusual there.  But in order to connect to the DB from the DW program and get the file and table information, DW also creates a folder on the web site called _mmServerScripts and puts two files in there (MMHTTPDB.php and mysql.php).  Those two files are critical for allowing DW to connect and display database information.  They are not used in the live application, so if you were to use the above information as the basis for your database calls, it would work just like DaveBaldwin's code works.

The issue here is how DW itself connects to the db, not so much the code it generates.   The most common issues with DW database connections are incorrect Site path definitions.  If the above folder is not present in the public root of the site, DW cannot use its internal stuff.
0
 
Dave BaldwinFixer of ProblemsCommented:
Godaddy MySQL servers for external access are not on the web domain but on a separate domain they have for the servers.
0
 
Jason C. LevineNo oneCommented:
Doesn't matter as far as DW is concerned.  If the mysql user has permission to access the remote server from any IP address and the site definition is correct in DW, it should work.
0
 
napsternovaDeveloperAuthor Commented:
Wow, I actually got DW to connect and create a Recordset.  I will post my findings
0
 
Jason C. LevineNo oneCommented:
Great!
0
 
napsternovaDeveloperAuthor Commented:
Thank you so much for all your help.  I am not 100% sure why "all of a sudden" it connected but it did.  I will inspect it once I am done with the job.  I split the points because both of you contributed pretty equally.
0
 
Dave BaldwinFixer of ProblemsCommented:
Thanks.  You probably got all the pieces right.  Glad to help.
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 9
  • 8
  • 7
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now