Table of Contents

ADOdb Proxy Server

This functionality is deprecated as of ADOdb 5.21.0 and will be removed in 5.22.0. It could be reinstated, if the community contributes with necessary security enhancements, as discussed on Github.

Introduction

The ADOdb Proxy server provides a simple method of extending a database connection to provide a simple REST server via http. It provides a limited number of ADOdb commands that can be executed across an http channel against any supported database.

Security warning - use with extreme caution ! Depending on how it is setup, this feature can potentially expose the database to attacks, particularly if used with a privileged user account.

Server Side Usage

Modify the server.php as required to provide a database connection

/*
 * Define the IP address you want to accept requests from
 * as a security measure. If blank we accept anyone
 */
$ACCEPTIP = '192.168.0.65';
 
/*
 * Connection parameters
 */
$driver = 'mysqli';
$host = 'localhost';
$uid = 'proxy';
$pwd = 'proxy';
$database = 'employees';

Client Side Usage

Configuration of the client side differs only slightly from the normal ADOdb configuration. For information about the client side driver, see Proxy Client

include '../adodb-master/adodb.inc.php';
/*
* We must manually include the driver that is used on the server side. This is
* so that database specific objects can be correctly interpreted on the client
* side
*/
include '../adodb-master/drivers/adodb-mysqli.inc.php';
 
$db = ADOnewConnection('proxy');
 
/*
* Connection honors $ADODB_FETCH_MODE, but not $db->setFetchMode();
*/
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
 
/*
* define a connection directly to the server program
*/
$url = 'http://192.168.1.109/adodb-master/server.php';
 
/*
* Create a connection
*/
$db->connect($url);
 
/*
* Create an SQL command
*/
$sql = "SELECT * FROM employees";
 
/*
* Execute and treat exactly the same as a normal ADOdb result set
*/
$result = $db->selectLimit($sql,1,10);
while ($r = $result->fetchRow())
  print_r($r);

Limitations