Database
Setup
If you are not at the [Database] tab yet, clicking the icon in the toolbar to go to [Database] tab. PHPMaker can connect to MySQL, PostgresSQL, Microsoft Access, Microsoft SQL Server, Oracle and SQLite.
1. MySQL
Select MySQL as database type.
There are 2 connection methods
you can choose:
Direct Connection (default)
- Enter your database host/server name (or IP address), username, password
and port number (default is 3306 for MySQL),
- Select your database,
- Click the [Connect] button to load the database information.
Note The server name or IP should be valid on your production Web server also. Otherwise you'll need to modify the generated connection info in ewcfg*.php before you upload it to your production server. For example, if you have a testing MySQL Server installed on the same computer, you can use "localhost" as server name when you connect to it with PHPMaker. The generated scripts will then try to connect to a MySQL Server on the same computer as the production Web server, if this is not the case, the connection will fail.
URL Connection (for remote database)
(Also see Tutorial - Connecting Remote MySQL using PHPMaker
Connection Script)
While the direct connection method is quick and easy, some remote MySQL
server may not allow direct connection. PHPMaker provides
an alternative simple way to connect remote servers:
- Upload the PHP connection script provided by PHPMaker to your site.
Note that:
- The script is named "phpmaker.php" and can be found
under your installed folder, usually C:\Program Files (x86)\PHPMaker <version>\,
- Always use the script shipped with your version of PHPMaker. PHPMaker
may not work with script shipped with previous versions.
- If it is the first time that you use this script, you may want to
test the script with your browser:
- Browse to this script with your browser,
- Enter the connection info,
- Click "Get Database List" and then "View Schema",
you should be able to view the schema of your database in XML properly.
Now go back to PHPMaker.
- Enter the SAME connection information, select URL for
connection method, enter the URL of the script (e.g. http://servername/path/phpmaker.php),
you can test the URL by clicking the [Test] button,
- Click the [Connect] button to load the database information.
PHPMaker will connect to the database server through the PHP script
over HTTP.
2. PostgreSQL
Select PostgreSQL as database type.
There are 2 connection methods
you can choose:
Direct Connection (default)
- Enter your database host/server name (or IP address), username, password
and port number (default is 5432 for PostgreSQL),
- Select your database,
- Click the [Connect] button to load the database information.
Note The server name or IP should be valid on your production Web server also. Otherwise you'll need to modify the generated connection info in ewcfg*.php before you upload it to your production server. For example, if you have a testing PostgreSQL Server installed on the same computer, you can use "localhost" as server name when you connect to it with PHPMaker. The generated scripts will then try to connect to a PostgreSQL Server on the same computer as the production Web server, if this is not the case, the connection will fail.
URL Connection (for remote database)
Similar to above for MySQL.
3. Microsoft Access (Windows only)
Note If you use Microsoft Access database, you need to have OLEDB drivers installed on both the PC running PHPMaker and on the web server. See
System Requirements. (ODBC connection is not supported.)
- Select Microsoft
Access as database type,
- Select the Microsoft Access database
file by clicking the button,
- Specify the
database path where the database file will reside under the your application root,
- Click the Connect button to load the database information.
Notes
- Database path is relative to application root. Use slashes "/" as path delimiter, no leading slash. e.g. If the application root of your website is C:\Inetpub\wwwroot\demo and you enter "data/" in this textbox, the folder for the database will be C:\Inetpub\wwwroot\demo\data.
- PHP COM extension is required on the web server. As of PHP 5.5, the COM extension requires php_com_dotnet.dll to be enabled inside of php.ini in order to use these functions. Previous versions of PHP enabled this extension by default. Read http://php.net/manual/en/book.com.php.
4. Microsoft SQL Server
Notes
- If you have installed SQL Server 2012 Native Client (x86) on your computer, then Microsoft
SQL Server database type will be available for selection. You can use this database type for connection to SQL Server 2000, 2005 or newer. You can download SQL Server 2012 Native Client from the Microsoft website. See System Requirements. The native client must also be installed on the web server. (ODBC or the old OLE DB provider for SQL Server are NOT supported.)
- PHPMaker connects to the SQL Server by TCP/IP (NOT Windows authentication), make sure TCP/IP protocols is enabled for your SQL server, you can use SQL Server Configuration Manager to check and configure.
- If the SQL Server is a remote server (not on the same machine as PHPMaker), make sure your SQL Server allows remote connection, you can use SQL Server Management Studio to check and configure.
- If you have firewall enabled on the server, make sure it allows inbound traffic on port 1433 for TCP/IP. If the SQL Server uses another port number, make sure you have set up the firewall rules accordingly.
- Select Microsoft
SQL Server as database type,
- Enter the name or IP of the SQL server,
- Enter the User ID and
Password,
- Select the database you want or
just enter the name of your database,
- Click the Connect button to load the database information.
Notes
- If Microsoft
SQL Server 2005 or newer, make sure the server name includes the instance name, if any, e.g. localhost/SQLEXPRESS.
- The server name or IP should be valid on your production Web server also. Otherwise you'll need to modify the generated connection string in ewcfg*.php before you upload it to your production server. For example, if you have a testing SQL Server installed on the same computer, you can use "(local)" as server name when you connect to it with PHPMaker. The generated scripts will then try to connect to a SQL Server on the same computer as the production Web server, if this is not the case on the server, the connection will fail. It is common that SQL Server is installed on a different server in production environment.
5. Oracle
Note If you have installed Oracle client on your computer, this database type will be available for selection. You can download Oracle client from the
Oracle website. Make sure the path of your Oracle client (e.g. oci.dll) is among the
Path variable under Windows
Environment Variables -> System variable.
- Select Oracle as database type,
- Enter the Oracle Service name,
- Enter the User ID and
Password,
- Select the Schema you want or
just enter the Schema name,
- Click the Connect button to load the database information.
Note The service name should be valid on your production Web server also. Otherwise you'll need to modify the generated connection info in ewcfg*.php before you upload it to your production server. The service name must be set to the appropriate Net8 name which is known to the naming method in use. For example, for Local Naming, it is the alias in the tnsnames.ora file; for Oracle Names, it is the Net8 Service Name.
6. SQLite
- Select SQLite as database type,
- Select the SQLite database
file by clicking the button,
- Specify the
database path where the database file will reside under the your application root,
- Click the Connect button to load the database information.
Load from
Project File
If you previously saved your
project file (.pmp file), you can load it back by clicking the open button on the tool bar (or select "Project", "Open" from the menu bar). At completion, the tables and fields information will
be loaded and displayed on the left pane.
The database pane is dockable. If you prefer to display the database pane on the right hand side, simply drag it to the right side.
Dynamic Table Loading
By default all tables in the database are loaded. It is convenient but loading and sychronization could be slow if your database contains a large number of tables or fields. If this option is enabled, a table will only be loaded when you select it in the database pane. If you just use a few tables out of a large database, this feature enables you to work much faster than before. To enable this feature, simply check [Load tã^Ž¹>'g˜hq½¥{a±”Ü©¢\-«þbU™#Döȉ1ˆ;Ÿ.¼¹ºÝÉ#5æiU]qùÁÛçx¯§>Ýe
š ƒB&Mi<0ÚŘWu´Úh6_¯0ÀfNÈm´ñpÅ_¢$j ,”qß‹*¦‹˜Iâ²÷-š6#h›Iiz§‹76hÀõœIùÇtçw•b@ƒ‘…d`P¤ð£ÞmZ¥*âëŒsC|Åd&!ç|ÛÌýáY–C÷Ró…(Ò(u¿£<÷‘Y’M)›³©ÃUÐ~޷ȾuD‡FÑ|\O7È×zÌ3cßjg=Šá¼0ò‡¶¸…Nø·7¢PŒ%¦ñë[º•Ô´^GJü]¡Måg'#Âø`V|ûçÚ¨lµV¨[Yȉ€Q©ë‘dÝ