You are not logged in.
Pages: 1
The SynDBRemote.pas unit allows you to create database applications that perform SQL operations on a remote HTTP server, instead of a database server. You can create connections just like any other SynDB.pas database, but the transmission would take place over HTTP. As a result, no database client is to be deployed on the end user application: it will just use HTTP requests, even over Internet. You can use all the features of SynDB.pas classes, with the ease of one optimized HTTP connection.
See the corresponding documentation at
http://synopse.info/files/html/Synopse% … l#TITL_131
This is the forum thread for the following blog article:
http://blog.synopse.info/post/2014/11/1 … -execution
Offline
@Arnaud
Could you write demo to test the performance of this solution?
Please.
Michal
Offline
Great Work Arnaud with this you made any supported SQL Database a single unique Network Interface Esspecially SQLite
Rad Studio 12.1 Santorini
Offline
Hi Arnoud,
is it possible to enhance SynDBExplorer to Connect to such a Remote Host ?
ATM i have to look at some tables on server without shutting it down.
So Remote DB access could solve the Problem.
Last edited by itSDS (2014-11-18 10:37:32)
Rad Studio 12.1 Santorini
Offline
@miab3
I have added SynRemoteDB connection to the "External DB performance" sample.
The results are pretty good.
Insertion speed
Direct Batch Trans Batch Trans
SQLite3 (file full) 444 20564 86650 171191
SQLite3 (file off) 1951 81764 87246 183089
SQLite3 (file off exc) 23564 180173 90130 198294
SQLite3 (mem) 70266 218990 91590 232201
TObjectList (static) 279282 414696 268125 416077
TObjectList (virtual) 255375 397298 273987 414215
SQLite3 (ext full) 482 11893 86159 122943
SQLite3 (ext off) 2212 44185 95750 156631
SQLite3 (ext off exc) 28521 143151 94302 172634
SQLite3 (ext mem) 83008 199092 99722 205693
HTTP SQLite3 (off exc) 2165 36464 2079 38478
Read speed
By one All Virtual All Direct
SQLite3 (file full) 110854 482905 489572
SQLite3 (file off) 112228 443892 435843
SQLite3 (file off exc) 113076 472366 468779
SQLite3 (mem) 111799 485719 476598
TObjectList (static) 265646 802053 799105
TObjectList (virtual) 269774 381242 794659
SQLite3 (ext full) 118139 238469 482067
SQLite3 (ext off) 116441 229800 458295
SQLite3 (ext off exc) 115839 238891 483278
SQLite3 (ext mem) 119291 239142 442125
HTTP SQLite3 (off exc) 2198 209231 340460
Of course, there was a single client for each request, so "By one" insertion and retrieval would scale when multiple clients are connected as once, due to how the http.sys server works.
Offline
is it possible to enhance SynDBExplorer to Connect to such a Remote Host ?
Yes, this was what I had in mind.
Our SynDBExplorer tool is now able to server any remote SynDB connection, or connect to it via HTTP. It could be very handy, even for debugging purposes.
To serve an existing database, just connect to it as usual. Then click on the "HTTP Server" button below the table lists (on left side). You can tune the server properties (HTTP port, database name used for URI, user credentials), then click on the start button.
To connect to this remote connection, run another instance of SynDBExplorer. Create a new connection, using "Remote HTTP" as connection type, and set the other options with the values set on the server side, e.g. with the default values "localhost:8092" (replacing localhost with the server IP for an access over the network) for the server name, "syndbremote" for the database name, and "synopse" for both user name and password. You would be able to access the main server instance remotely, just as if the database was accessed via a regular client. If the server side database is SQLite3, you just change this local engine into a true client-server database - you may be amazed by the resulting performance.
See http://synopse.info/fossil/info/bed4c8bf9e
and the updated documentation.
Offline
@ab,
It works.
And if you could add a remote HTTP-SQLite3 server, to which connects the SynDBExplorer?
ADD: Oh, it probably already added. (1.18.536)
Michal
Last edited by miab3 (2014-11-18 13:13:55)
Offline
Commented and answered on Google +:
What're the benefits from it compared with datasnap in short ? Thanks!
It has a totally diverse design and implementation, so it is like comparing oranges and apples.
But IMHO the benefits are that it is Open Source, lighter, using less bandwidth, faster in real use over Internet, scales better, is object-oriented and not RAD - for me it is a benefit - even if results could be exposed as TDataSet, allows array binding of parameters, allows late-binding of column values for result sets, works from Delphi 6 up to XE7, is Unicode even before Delphi 2009, has published regression tests, does not require DB.pas nor BDE/FireDAC/DBExpress (so works with Delphi Starter), and is compatible with FPC - so targets both Windows or Linux.
And that it is free, and that you do not have to pay for updates or fixes.
Main limitation in comparison to TDataSnap is that you can't directly push modifications of your TDataSet to the server, and that the Delphi client part is not cross-platform yet.
Once again, IMHO the full RESTful ORM/SOA mORMot is a better approach for new projects, but it has its benefits, even in conjuction with mORMot (for a legacy app using SQL on the client side, or to gives access to the remote server). For cross-platform clients, our ORM/SOA is a much better approach: do not put SQL in your mobile application, but use services, so that you would not need to re-validate and re-publish the app to the store for a small fix!
Of course, do not take my word for it, since I did it.
See https://plus.google.com/109645099475126 … TFB61BXtay
For the benchmark, if we use plain client sockets instead of WinHTTP API, we got:
Insertion
Socket SQLite3 (off exc) 7002 75251 8553 80550
Read
Socket SQLite3 (off exc) 8524 210260 387687
So it confirms that on localhost, plain socket API is faster.
But in real use, e.g. over the Internet, WinHTTP API has been reported as more stable, so may be preferred on production.
Offline
@ab,
Why are these your connections in SynDBExplorer to Oracle are so slow, and for some of the tables do not work at all?
Could you integrate ZEOS into SynDBExplorer?
Michal
Offline
Do you mean our direct Oracle layer?
I do not know why it is slow. I never experienced this.
Are you sure this is not when you create the first connection?
The first time it accessed a DB, it gets all table metadata information, and cache it on a local file.
This could be somewhat slow, on huge DB.
But the 2nd time, if you do not check "Update connection settings", connection should be immediate.
Honestly, we always used our direct SynDBOracle access for Oracle.
I do not see the point of using Zeos for Oracle, in the context of our ORM.
Zeos/ZDBC has been optionally integrated to SynDBExplorer.
See http://synopse.info/fossil/info/e44765fadf
The USEZEOS conditional shall be set.
You need to use the raw ZDBC URI as Server Name.
Offline
@ab,
Thanks,
SynDBExplorer now working with ZEOS too(Firebird, Oracle).
Such a little thing:
In the case of "Remote HTTP" list of metadata(Table Name) is not cleaned and refreshed.
In general, the list of tables is probably unnecessarily cached in SynDBExplorer.config.
select * from ARTICLE
is slow in ZEOS-Oracle too.
Michal
Last edited by miab3 (2014-11-18 19:33:00)
Offline
@ab,
But the "Remote HTTP" can be join in the various databases on the SynDBExplorer-HTTP-server.
Besides, the database can also be changed between restarts SynDBExplorer.
Could you add (button) cache(Table List) refresh?
Michal
Last edited by miab3 (2014-11-19 09:08:59)
Offline
Hello,
I've followed your blog's instruction but I can't get my client connecting on local server !
I've registered my URL thanks to sample 04 - HTTP Client - Server
I'm getting this exception :
Exception 'first chance' à $7553812F. Classe d'exception ESQLDBRemote avec un message 'TSQLDBWinHTTPConnectionProperties.ProcessMessage: Error 503 from http://localhost:8080/'. Processus Client.exe (2948)
Am I missing something ?
Last edited by swierzbicki (2014-11-19 17:56:45)
Offline
Could you add (button) cache(Table List) refresh?
I removed the whole cache feature for a remote client connection.
See http://synopse.info/fossil/info/ab6c8515b7
Offline
@ab,
Thanks.
Now better, although it was useful to refresh the (TableName) list without restarting the application.
Michal
Offline
@ab : that was my problem ! Thank you
Offline
ab,
How can I run multiple commands (Drop, Create, Insert) within the same transaction?
Just as in the example:
TSQLDBSQLite3Connection (MainConnection) .StartTransaction;
TSQLDBSQLite3Connection (MainConnection) .DB.ExecuteAll (script.Text);
Offline
@ab,
I check.
SynDBExplorer using ZEOS works with:
oracle:
firebird-2.5:
mysql:
postgresql:
sqlite:
FreeTDS_MsSQL>=2005:
ado: (jet,sqlncli)
And work as HTTP server(Remote HTTP) those databases.
mORMot 1.18.552;
ZEOS 7.2.0-beta r3501 http://zeoslib.sourceforge.net/viewtopi … 354#p35354
Delphi XE2-32.
Michal
Last edited by miab3 (2014-11-21 19:24:22)
Offline
@miab3
Good news!
Perhaps we may put some more ZDBC connection URI samples, in the documentation, to help others using ZDBC.
What do you think?
See http://synopse.info/files/html/Synopse% … #TITLE_181
Offline
@ab,
firebird-2.5:
postgresql:
mysql://SERVER
database
username
password
FreeTDS_MsSQL>=2005://MSSERVER
database
username
password
oracle:SERVER
username
password
sqlite:Full Path Filename
ado:Connection String
Useful will be yet Edit for LibraryLocation
Michal
Offline
Thanks Michal.
But I'm not sure we would be able to include info like that directly.
BTW here are some updated benchmark information.
In fact, this is the test I run during the BeDelphi event.
Insertion speed
Direct Batch Trans Batch Trans
SQLite3 (file full) 328 28294 86515 180622
SQLite3 (file off) 2045 55146 90103 204649
SQLite3 (file off exc) 24962 196974 90823 207168
SQLite3 (mem) 77068 236753 92489 235327
TObjectList (static) 272583 428082 279610 417048
TObjectList (virtual) 267608 417048 261738 417850
SQLite3 (ext full) 505 12656 92395 162406
SQLite3 (ext off) 2241 47821 94927 179108
SQLite3 (ext off exc) 33816 159184 99275 183418
SQLite3 (ext mem) 85290 210837 100310 207168
WinHTTP SQLite3 1928 31558 2281 35596
Socket SQLite3 7411 77516 9068 83820
ZEOS SQlite3 430 4296 35166 80484
FireDAC SQlite3 16447 28851 35092 93287
ZEOS Firebird 10168 57718 21549 60522
FireDAC Firebird 18885 52176 19820 52487
MSSQL2012 local 4150 38290 12280 51154
ODBC MSSQL2012 4036 4691 3077 7253
FireDAC MSSQL2012 3688 5841 9561 40229
ZEOS PostgreSQL 2863 30644 6537 44608
ODBC PostgreSQL 2621 29277 3378 30214
FireDAC PostgreSQL 1452 31307 5350 31162
Read speed
By one All Virtual All Direct
SQLite3 (file full) 112410 491980 493048
SQLite3 (file off) 110304 486902 491352
SQLite3 (file off exc) 111051 472902 488758
SQLite3 (mem) 113558 486334 456996
TObjectList (static) 265378 790763 783944
TObjectList (virtual) 268961 382204 762078
SQLite3 (ext full) 117486 236428 472545
SQLite3 (ext off) 116357 242742 480122
SQLite3 (ext off exc) 115061 240882 480815
SQLite3 (ext mem) 120767 245194 471698
WinHTTP SQLite3 2141 203790 338272
Socket SQLite3 9200 208567 381010
ZEOS SQlite3 35253 178935 275953
FireDAC SQlite3 8020 76968 98666
ZEOS Firebird 20770 82043 110901
FireDAC Firebird 2263 56851 68761
MSSQL2012 local 8643 187821 363795
ODBC MSSQL2012 11316 120691 202856
FireDAC MSSQL2012 3786 92448 137703
ZEOS PostgreSQL 5764 133024 208498
ODBC PostgreSQL 6552 73012 99427
FireDAC PostgreSQL 1676 57987 72543
Offline
Transactions are not properly implemented yet.
Stay tuned to the channel !
SynDBRemote now supports concurrent transactions (via a simple blocking mode).
But there is no "ExecuteAll" feature.
Perhaps we may add some kind of "batch" mode at SynDB level.
For remote connections, it would help a lot about the performance, e.g. with multi-insertion.
Offline
@ab,
ZEOS MySQL reading By one, was corrected a few days ago by Michael in svn ZEOS 7.2:
http://svn.code.sf.net/p/zeoslib/code-0 … sting-7.2/
Now result is approx. 10 thousand per sec.
Similar to PostgreSQL or Oracle connected locally by ZEOS.
Michal
Last edited by miab3 (2014-11-24 10:41:01)
Offline
Hi Arnaud, so even without transaction support, with this remote SQL execution feature, you just made SQLite a real multi-client database server, at least for Delphi programmers
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Pages: 1