Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Help me with MySQL connection strategy

LEGEND ,
Jul 17, 2006 Jul 17, 2006

Copy link to clipboard

Copied

I have a site with a connection to a MySQL datafile that I am testing
locally (the MySQL server/testing server is a local box).

In the Connections folder, my connection file has a MySQL server definition
that is a local box's IP address. What happens when I upload these pages?
Do I then have to break the connection with the local database in my local
files, and re-specify the remote connection info? It makes sense that I
would have to do it, but it seems awkward to have to go back and forth like
that.....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



TOPICS
Server side applications

Views

341
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 17, 2006 Jul 17, 2006

Copy link to clipboard

Copied

> In the Connections folder, my connection file has a MySQL server
> definition that is a local box's IP address. What happens when I upload
> these pages? Do I then have to break the connection with the local
> database in my local files, and re-specify the remote connection info? It
> makes sense that I would have to do it, but it seems awkward to have to go
> back and forth like that.....

I can't speak to the specifics of PHP and MySQL, but in ASP.net we us a
config file to spec the db connection and, indeed, we usually have a
separate config file for local testing than we do for remote testing.

Can you have two connection files and then choose which one to use
programatically? Maybe have some PHP code that grabs the current URL and if
it's your IP, uses your local config and if it's the domain, uses the remote
config?

-Darrel


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 17, 2006 Jul 17, 2006

Copy link to clipboard

Copied

Yeah - maybe that'll work. Define two connections - one local and the other
remote....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"darrel" <notreal@nowhere.com> wrote in message
news:e9h01a$6dm$1@forums.macromedia.com...
>> In the Connections folder, my connection file has a MySQL server
>> definition that is a local box's IP address. What happens when I upload
>> these pages? Do I then have to break the connection with the local
>> database in my local files, and re-specify the remote connection info?
>> It makes sense that I would have to do it, but it seems awkward to have
>> to go back and forth like that.....
>
> I can't speak to the specifics of PHP and MySQL, but in ASP.net we us a
> config file to spec the db connection and, indeed, we usually have a
> separate config file for local testing than we do for remote testing.
>
> Can you have two connection files and then choose which one to use
> programatically? Maybe have some PHP code that grabs the current URL and
> if it's your IP, uses your local config and if it's the domain, uses the
> remote config?
>
> -Darrel
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 17, 2006 Jul 17, 2006

Copy link to clipboard

Copied

Murray *ACE* wrote:
> I have a site with a connection to a MySQL datafile that I am testing
> locally (the MySQL server/testing server is a local box).
>
> In the Connections folder, my connection file has a MySQL server definition
> that is a local box's IP address. What happens when I upload these pages?

In 95% of cases, it's no problem because the correct address for MySQL
is localhost both in a local testing environment and on a remote server.
Where the two addresses differ, you need to create one file for remote
connection and upload it. Then redefine the connection for local
testing. As long as you don't overwrite the remote file with the local
one, everything should work fine at both ends.

--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 17, 2006 Jul 17, 2006

Copy link to clipboard

Copied

That makes sense - thanks, David!

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:e9h4a5$b07$2@forums.macromedia.com...
> Murray *ACE* wrote:
>> I have a site with a connection to a MySQL datafile that I am testing
>> locally (the MySQL server/testing server is a local box).
>>
>> In the Connections folder, my connection file has a MySQL server
>> definition that is a local box's IP address. What happens when I upload
>> these pages?
>
> In 95% of cases, it's no problem because the correct address for MySQL is
> localhost both in a local testing environment and on a remote server.
> Where the two addresses differ, you need to create one file for remote
> connection and upload it. Then redefine the connection for local testing.
> As long as you don't overwrite the remote file with the local one,
> everything should work fine at both ends.
>
> --
> David Powers
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> Author, "Foundation PHP 5 for Flash" (friends of ED)
> http://foundationphp.com/


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 17, 2006 Jul 17, 2006

Copy link to clipboard

Copied

LATEST
Hi Murray,

I've just been trying something similar, and the trick was to upload the connection file, edited to reflect the host's details rather than the testing server's details, so in my case I had to change it from :

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_ConnDatabaseTest = "localhost:8888";
$database_ConnDatabaseTest = "database1";
$username_ConnDatabaseTest = "root";
$password_ConnDatabaseTest = "root";
$ConnDatabaseTest = mysql_pconnect($hostname_ConnDatabaseTest, $username_ConnDatabaseTest, $password_ConnDatabaseTest) or trigger_error(mysql_error(),E_USER_ERROR);
?>

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_ConnDatabaseTest = "localhost";
$database_ConnDatabaseTest = "username_database";
$username_ConnDatabaseTest = "username";
$ConnDatabaseTest = mysql_pconnect($hostname_ConnDatabaseTest, $username_ConnDatabaseTest) or trigger_error(mysql_error(),E_USER_ERROR);
?>

I'd also taken out the references to passwords from other error messages I had - but it's working for now, and it's late here, so I'll look at the fine detail later.

Hope you got it sorted.

Iain

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines