MySQLTunnel written in PHP

aalekizoglou

Member
Licensed User
Longtime User
MySQL Tunnel written in PHP

For whatever it's worthing, I am building in B4A a set of classes to accomplish a Dataset to connect Android to remote MySQL through an HTTP to MySQL Tunnel. The tunnel I am using (MySQLTunnel) is written in PHP by our development team. It supports encryption, compression and results a JSON descriptive resultset. You may find it here:

https://sourceforge.net/projects/mysqltunnel/?source=directory

The B4A dataset (based on functionality found on Delphi's UniDAC) supports a full set of functions to work with the DB. I will post it on libraries as soon as I have a working copy.
 
Last edited:

grant1842

Active Member
Licensed User
Longtime User
Very Nice I love Delphi.
 
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
Hi again,
Have you any Delphi code using tunnel.
Using zeos components I tend to loose connection, but thought this might be an easy way to communicate with MySQL.
This would help me with a web hosting service that limits the use of MySQL to specific IP addresses.
Sorry this is not b4a related but will be very handy for this entire project.

Tom
 
Upvote 0

keirS

Well-Known Member
Licensed User
Longtime User
Interesting approach. I have been playing round with a Restful API written in PHP using PDO and the Slim frame work. I suspect your tunnel will give faster performance but a Restful API will run on any server that supports PHP and because it uses PDO it's simple to support multiple database and web server platforms. My test server is running IIS and Postgres and the authors production sevrver is running Apache and MySQL.

It's a bit of conundrum. Go for something which has faster performance but is limited in platform or go for slower performance but with an open architecture that means you can fit in with the clients existing platforms.
 
Upvote 0

aalekizoglou

Member
Licensed User
Longtime User
Hi again,
Have you any Delphi code using tunnel.
Using zeos components I tend to loose connection, but thought this might be an easy way to communicate with MySQL.
This would help me with a web hosting service that limits the use of MySQL to specific IP addresses.
Sorry this is not b4a related but will be very handy for this entire project.

Tom

Tom,

I've been using UniDAC in Delphi for CLOUD MySQL for more than 2,5 years now. The disconnections issue is in fact an issue related not only to MySQL but routers and network inbetween. I use an exception handler in my UniConnection components to reconnect to the DB without affecting the user or the interface whenever the connection is dropped. One other issue I've used is pinging the service (MySQL) either issuing a "SELECT version()" or MySQL.ping to keep the connection alive from the server's point, since MySQL has a connection timeout.

I've tried a lot my tunnel as well as UniDAC's tunnel with Delphi and the performance overhead is huge. In fact our products realize direct-encrypted connections to our cloud servers (in Rackspace) and the performance is acceptable, since we've overcome with the disconnections issues.
Nowadays we are dealing with CopyCAT, a VCL to synch databases based on triggers. Quick performance, reliable and stable. We haven't put that in productions since there are issues we have to deal with the embedded databases we use, but the product seems to be very promising.

The tunnel is needed in cases such as mobile devices, etc. Just as B4A is targeted.
 
Upvote 0

aalekizoglou

Member
Licensed User
Longtime User
Interesting approach. I have been playing round with a Restful API written in PHP using PDO and the Slim frame work. I suspect your tunnel will give faster performance but a Restful API will run on any server that supports PHP and because it uses PDO it's simple to support multiple database and web server platforms. My test server is running IIS and Postgres and the authors production sevrver is running Apache and MySQL.

It's a bit of conundrum. Go for something which has faster performance but is limited in platform or go for slower performance but with an open architecture that means you can fit in with the clients existing platforms.

keirS,

thanks. In fact the tunnel is written to run on any PHP server, and by changing the DB relevant commands, which now are MySQL based, you can have a tunnel for other databases, such as Postgres, Oracle, SQLite, etc. Of course without PDO you will not have a database agnostic tunnel, but the performance, as you've realized too, is faster that anything else. On the other hand we need performance on the server since the whole tunneling process is network intensive and the mobile client needs to wait all the time from issuing the command to get the relevant answer back.

To tell the truth the whole tunneling idea was first based on Delphi, that's the reason most of the implementation remind Delphi's dataset class.

Regards,
 
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
Have any of the original Delphi code available in the public domain.
It might be slower than using unidac or zeos but it would be easier, don't you think.
Tom
 
Upvote 0

aalekizoglou

Member
Licensed User
Longtime User
Tom,

sorry I don't think I have the Delphi code available any more. It was outdated, written more than 2 years ago. And since we've changed to Delphi XE, I've just dropped the Delphi relevant code. But If you want you can check the relevant B4A source and rewrite to Delphi. I know it will take some time but this is what I've done initially to write the B4A code from Delphi's datasource.

Again sorry.
 
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
Will have a look.
I still use Delphi 7.
I want to use it as a method of exporting fom sqlite then to my MySQL database the either to windows or B4a.
I cannot quarantee that the client will have internet access.

If you could find any code tat would be great.
I do need data aware since i will b doing SQL calls to update my sqlite database.

Tom
 
Upvote 0
Top