Arne Vajhøj
2025-01-19 19:35:07 UTC
Reply
Permalinkhttps://sourceforge.net/projects/pjbs/
which has been forked at:
https://github.com/JCotton1123/php-jdbc-bridge
It allows PHP applications to access a database using a
JDBC driver.
It works like:
PHP app with PJBridge class-->proxy process with JDBC driver-->database
PJBridge.php is very simple so it was easy to convert to Python:
Python app with PJBridge class-->proxy process with JDBC driver-->database
And I even created a DB API 2.0 layer on top of it to be more Pythonesque:
Python app with PJBS and PJBridge classes-->proxy process with JDBC
driver-->database
And it seems to work reasonable well.
There are a few things to be aware:
* data are always returned as string so numeric data need to be
manual converted.
* no support for database transaction
* I have not tested error handling or performance
* very limited functional testing so lot of stuff may be missing
(feel free to add it!)
This tool is not particular interesting on common platforms like
Linux and Windows as both PHP and Python has drivers for almost
all databases available there.
But it is a bit more interesting on VMS as a driver for VMS
is not a top priority for most language projects and
database vendors. But the database vendors usually
provide a type 4 JDBC driver. A type 4 JDBC driver is a pure
Java JDBC driver, which means that you can copy the jar file
from Linux/Windows to VMS and it works.
So with:
portable PHP/Python API-->portable Java proxy-->portable type 4 JDBC driver
it all works even if the language project and the database vendor has
not even heard about VMS!
And this is not just theory. I have tested with:
- MySQL
- PostgreSQL
- Oracle DB - thin
- IBM DB2
- MS SQLServer
- SQLite (*)
- Derby
- H2
- HSQLDB
And previously I have tested PJBS with:
- Rdb - native (*)
- Rdb - thin
- Mimer
*) Type 2 not type 4 so VMS version required!
I would group them in:
* PHP/Python drivers available (or will be available) on VMS: MySQL,
PostgreSQL, SQLite
* not interesting for PHP/Python developers (they will prefer SQLIte):
Derby, H2, HSQLDB
* potential relevance of PJBS: Oracle DB, IBM DB2, MS SQLServer
If anyone want to play with it then it is available at:
https://www.vajhoej.dk/arne/vmsstuff/pjbs/
Arne