Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Database connection issue


bebbebbeb

Recommended Posts

Posted

Hi

 

I'm using Apache locally to test some osC files so that I don't have to do that live. I have a copy of the site on my local machine, which connects to the remote, live database at 'x.x.x.x'. This live database is powering the live site. The live site is working fine, and I can get inot the db via phpMyAdmin just fine. So obviously the db itself is ok.

 

I have my local Apache file set to the correct folder:

 

#<VirtualHost 127.0.0.9>

# ServerAdmin [email protected]

DocumentRoot C:\sites/sitefolder

ServerName 127.0.0.9

# ErrorLog logs/dummy-host.example.com-error_log

# CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>

 

However, when I put "http://127.0.0.9" into my browser, I'm getting the error message "Warning: mysql_connect(): Can't connect to MySQL server on 'x.x.x.x'(10065) in C:\sites\sitefolder\includes\functions\database.php on line 19

Unable to connect to database server!

 

Apache seems to be finding the site locally ok, and the remote db IP is correct, and I know that db works ok in itself.

 

So what's the problem?

 

Any ideas very much appreciated!

Posted

Well, this is wrong to start with. You either use forward or back slashes and not a mix of both:

 

DocumentRoot C:\sites/sitefolder

 

This also looks wrong:

 

#<VirtualHost 127.0.0.9> //this is usually 127.0.0.1

 

But I think your problem is one of permission to access the online database (if I understand correctly what you are trying to do).

 

If this is a dedicated server of your own you are connecting to then you will need to give yourself permission to access the live database from your machine.

 

If you are on a shared server then you can't just access an online database from a local machine, because if you could then so could anyone else.

 

For a hosting company to give you access through their firewall you'd have to have a dedicated ip address for your internet connection and then they'd have to grant that ip address access through the firewall. On a shared server I wouldn't hold your breath waiting!

 

Vger

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...