This topic is locked

Moving the project file and updating the MySQL Database connection before opening file

1/22/2023 6:01:57 PM
PHPRunner Tips and Tricks
1NET author

I found an issue with moving a project file from one of my development computers which uses a Linux server on a lan for the mysql database @192.168.1.200

Moving my project file to my laptop caused issues where the database could not be accessed as the device is mobile and not connected to the same network.

I had to locate the connection settings inside the project file to allow me to open the project without loosing connections, table joins, etc.....

in my .phpr file the changes needed to be made on line 150323, this will be a different line in other projects. However this is the identifiers that need to be changed, i've highlighted them in bold.

<m_strID>myDatabase_at_192_168_1_200</m_strID> **// Leave this alone, its the identifier for every table connection within the scripting, it does not need to be changed**
<m_strName>myDatabase at 192.168.1.200</m_strName> **// Leave this alone, its the identifier for every table connection within the scripting, it does not need to be changed**
<m_strConnectionString>mysql;**127.0.0.1**;**Username**;**Password**;;**myDatabase**;;1</m_strConnectionString>
<m_nDatabaseType>0</m_nDatabaseType>
<m_cLeftWrap>`</m_cLeftWrap>
<m_cRightWrap>`</m_cRightWrap>
<m_lastDbSyncTime>1668147533</m_lastDbSyncTime>
<m_strDBPath>db</m_strDBPath>
<m_bUseServerMapPath>1</m_bUseServerMapPath>
<m_strCustomDBConnection></m_strCustomDBConnection>
<m_CustomDBConnections></m_CustomDBConnections>
<m_connStringType>mysql</m_connStringType>
<m_strConnectInfo1>**127.0.0.1**</m_strConnectInfo1>
<m_strConnectInfo2>**Username**</m_strConnectInfo2>
<m_strConnectInfo3>**Password**</m_strConnectInfo3>
<m_strConnectInfo4></m_strConnectInfo4>
<m_strConnectInfo5>**myDatabase**</m_strConnectInfo5>
<m_strConnectInfo6></m_strConnectInfo6>
<m_strConnectInfo7>1</m_strConnectInfo7>
<m_strODBCString>DRIVER={MySQL ODBC 3.51 Driver};Server=**127.0.0.1**;Uid=**Username**;Pwd=**Password**;Database=**myDatabase**;OPTION=3</m_strODBCString>
<m_strODBCUID>**Username**</m_strODBCUID>
<m_strODBCPWD>**Password**</m_strODBCPWD>
<dbtables>
Hope this may help someone.
fhumanes 1/23/2023

Hello,

Phprunner has the possibility of maintaining in the same project, multiple connections to databases to reproduce the environments of:

  • Developing
  • Deployment
  • Testing
  • Production
  • Etc.

To generate code for the environment, you just have to select the configuration of the connection that is required.

img alt

Regards,
fernando

1NET author 1/23/2023

Thankyou
I am aware of that process to change servers from local to online etc.

This does not help if you are completely changing environment from a lan 192.168.1.200 mysql database to a localised XAMPP mysql 127.0.0.1 database.
if you open the project without changing the info i initially posted you will loose all joins to tables, customised files for each table, everthing disappears.

Thanks for your input.

Kind Regards