PHP - JAVA Bridge System

Setting up the JAVA server:

  1. Locate the file Main.java and open it with a text editor

  2. Search for a line starting with Class.forName

  3. Add more Class.forName lines or adjust the existing ones as to load all the JDBC drivers you're going to use with this bridge

  4. Copy all needed drivers into the ext folder inside your JRE installation path

  5. Compile and launch the pjbs.Main class

I understand that having to edit some sources, copy some files around and recompiling things is not exactly user-friendly, but some experience in how to deal with JDBC drivers is necessary anyway because you're probably going to use this bridge toghether with closed source, poorly implemented drivers that may also require some other tweakings to work properly.

Using the PHP client class:

  1. require_once 'PJBS.php';

  2. create an instance with something like
    $drv = new PJBS();

  3. connect to a JDBC data source with
    $drv->connect([your jdbc url], [your username], [your password]);

  4. execute a query
    $res = $drv->exec('select * from [your table]');

  5. print the first result


Project page