Remote Firebird Database lazarus / 16-Databases ---------------------------------------------------------------------- Giu · 2012-11-04 14:58 I'M thinking in a little project. This app will be deployed to different customers and all data will be at a remote Firebird database with a tenant field in each table to independence of data of each customer. Similar to a SaaS application. Somebody has used this model and can share experiences with speed? Best practice should be to recover data and work with it in memory and sync under demand. This can be done with SQLdb or better I may take a look to Zeos components. Lasts months I "played"  with web development, and probably is the best way to get this, but I don't like web apps development and I don't like Java too much either (I don't feel comfortable developing in it, and I miss pascal too) I'm out of Lazarus project a lot of time, and I need some help. ---------------------------------------------------------------------- Phil · 2012-11-04 17:46 Quote from: Giu on November 04, 2012, 03:58:06 pmI'm out of Lazarus project a lot of time, and I need some help. The WaveMaker diagram on your blog shows a good way to think about this kind of app. The two variations that you're introducing are that you appear to want to use a native desktop app on the client side and you want to cache data locally. The key in all cases is to design each piece to be as independent as possible, so that replacing one piece has no effect on the others. If you have any hope of creating a mobile client (this kind of project just "screams" mobile to me), you should use SQLite for local data on the client side since SQLite is what's used with iOS and Android apps. You might also want to reconsider doing the client app in the browser. Doing that does not mean that you can't also have one or more native clients. Again, the key is independent pieces. Here's a simple example of a Web app that uses the qooxdoo JavaScript widgets for the client app (browser) and either a Pascal FCGI or PHP server app. Data for the Pascal app comes from a SQLite db on the server. Again, the client app doesn't care where the data is coming from as long as it's (1) asynchronous call and (2) data returned as JSON. And the client app doesn't care if it's running in a browser or in a Webview control in a native PhoneGap app. http://web.fastermac.net/~MacPgmr/qxotica/QxoticaStatus.html http://web.fastermac.net/~MacPgmr/qxotica/QxoticaTechNote1.html Thanks. -Phil ---------------------------------------------------------------------- Giu · 2012-11-04 18:33 Hi Phill Quote from: Phil on November 04, 2012, 06:46:18 pmQuote from: Giu on November 04, 2012, 03:58:06 pmI'm out of Lazarus project a lot of time, and I need some help. The WaveMaker diagram on your blog shows a good way to think about this kind of app. The two variations that you're introducing are that you appear to want to use a native desktop app on the client side and you want to cache data locally. The key in all cases is to design each piece to be as independent as possible, so that replacing one piece has no effect on the others. If you have any hope of creating a mobile client (this kind of project just "screams" mobile to me), you should use SQLite for local data on the client side since SQLite is what's used with iOS and Android apps. You might also want to reconsider doing the client app in the browser. Doing that does not mean that you can't also have one or more native clients. Again, the key is independent pieces. This diagram is not mine. WaveMaker is an opensource tool from VMWare to develop Web Apps over Dojo. Is a great great tool, but server side is Java, and I don't know why, but Java is superior to me. I cry every time I see it and I love FPC/Delphi. If needed, I develop in Java, but I'm in a position where I can choose. Otherwise, my intentions go in this way. We are planing an ERP software, and we want to deploy as SaaS application (customer will pay X monthly to use the soft), for this reason, all data will be hosted, and this data will be shared over the apps. I talked about data in memory, to avoid continuous connection over the database. Is the way WM works. It retrieves data from the database as JSON, and once you do an operation (saving a record for example) is when "service" is executed over the database again. We want to make it desktop too because we want an easy way to deploy to local for permanent licenses (not all people trust in cloud), and resellers. Our app will be reselled to resellers (sorry, a little long to explain  ) In addition to all of this, I'm checking FreeSpider this afternoon and looks interesting for our needs. Mobile development is not so important for this project. If there are later an easy way to integrate mobile apps into our suite, and developed over Lazarus great, if not, We have in mind to use PhoneGap or similar. QuoteHere's a simple example of a Web app that uses the qooxdoo JavaScript widgets for the client app (browser) and either a Pascal FCGI or PHP server app. Data for the Pascal app comes from a SQLite db on the server. Again, the client app doesn't care where the data is coming from as long as it's (1) asynchronous call and (2) data returned as JSON. And the client app doesn't care if it's running in a browser or in a Webview control in a native PhoneGap app. http://web.fastermac.net/~MacPgmr/qxotica/QxoticaStatus.html http://web.fastermac.net/~MacPgmr/qxotica/QxoticaTechNote1.html Thanks. -Phil Your links looks very interesting, I will check it. ---------------------------------------------------------------------- Phil · 2012-11-04 19:13 Quote from: Giu on November 04, 2012, 07:33:39 pmMobile development is not so important for this project. If there are later an easy way to integrate mobile apps into our suite, and developed over Lazarus great, if not, We have in mind to use PhoneGap or similar. Very good. I would just add a couple things here. First, it seems to me that any new application being developed today needs to have a mobile _story_, either a plan to get to mobile from day one or an awfully good reason why it doesn't. Your competitors will have a mobile story and I would expect customers to ask to see a mobile demo (I would). Also, keep in mind what PhoneGap is and what it isn't. With PhoneGap, the UI will _always_ be JavaScript. PhoneGap is a way of recycling mobile Web app JS, HTML and CSS into a "native" app. Coupled with a mature JS framework like qooxdoo, PhoneGap is great for a project where there's some uncertainty about whether it needs a mobile Web app, iOS native app or Android native app - or some combination of these. It allows you to have all 3 with the same client codebase. But it appears to me that PhoneGap is also used by many projects as a crutch, a way of not thinking seriously about mobile. PhoneGap native app are never as slick as a properly done native app (for example, an Objective-C app on iOS). But it can be appropriate for the right project. Just be sure about what your user expectations are for mobile. However, PhoneGap provides out of the box access to (via a native plugin on each platform) a great deal of native functionality if you need it (see http://docs.phonegap.com/en/2.2.0/index.html). You can also create your own plugins for PhoneGap that provide additional native code to your client JS. Normally PhoneGap plugins are done with, eg, Objective-C on iOS and Java on Android, since plugins need to be subclasses of the PhoneGap plugin class. But I've successfully created a PhoneGap plugin in Pascal for both iOS and Android using FPC: with iOS, this means using FPC's Objective Pascal dialect; with Android this means using FPC's JVM compiler (only in trunk currently). So this expands the possibilities for Pascal with PhoneGap. Something to keep in mind. Thanks. -Phil ---------------------------------------------------------------------- ttomas · 2012-11-04 20:04 Hi Giu we are on the same frequency. I plan to convert my client/server ERP to SaaS. My plans for now are: 1. Capable for more then 1000 ssl connected clients. 2. Windows/Linux/Mac binary client 3. 5-20 Firebird databases (same db shared by custumers) 4. Application Server-s (main problem for now) Some details For reduction of network traffic i will use binary protocol, compression and local embedded Firebird for local storage of some tables with some kind of replication (Examp. TabCustomer, TabArticle, etc). Only min. needed data will be transfer, no view data, no reports etc. This is needed for large number of clients. Every customer will have 1-50 clients and all clients from same customer will be connected with messaging system for notification of changes of critical data. Client will use one or two live tcp ssl connection.  App Server for now i test LNet FreePascal and Java Netty, must be Async server. Indy and Synapse is thread based and too much threads will kill the server. AppServer is main problem for now and I will like some suggestions and experience from community. Web clients will be added later for mobile. I don't like web server/services, http protocol, json/xml serialization/deserialization. Too mach waste of bandwidth, CPU and resources. ---------------------------------------------------------------------- denver · 2012-11-05 13:00 Hi, guy  I am using Lazarus to create a database application development framework which work in SaaS mode now. The Server Side is using ZeosLib, so it can connect to any database that zeoslib support. Application Server has both windows and linux version ( ubuntu ) now. I will upload the link for download the server and client application here later. Denver ---------------------------------------------------------------------- Giu · 2012-11-05 17:47 Quote from: PhillVery good. I would just add a couple things here. First, it seems to me that any new application being developed today needs to have a mobile _story_, either a plan to get to mobile from day one or an awfully good reason why it doesn't. Your competitors will have a mobile story and I would expect customers to ask to see a mobile demo (I would). I agree. Mobile is a very important thing to have in mind, but, I think, we don't have to develop around it. I mean. If one is good (or like) developing in FreePascal, or other language, I think is an error to change the way one works to fit mobile needs (web development for example). For this, I think, a layer in Mobile device, developed in PhoneGap for example, and a ServerApp/CGI listening petitions, could be a great combination, until all development could be done all in Pascal. I'm out a lot of months of Lazarus/FPC world, and I don't know in wich state are development for iOS/Android devices under Lazarus. Quote from: tthomasFor reduction of network traffic i will use binary protocol, compression and local embedded Firebird for local storage of some tables with some kind of replication (Examp. TabCustomer, TabArticle, etc). Only min. needed data will be transfer, no view data, no reports etc. This is needed for large number of clients. Interesting. I though something like forms and code embbebed in DLL/so and update from the server under demand. With this approach, and update, in CRM module for example, only needs one file to update. I didn't though about local data, My intentions was to access directly to database remoting, for this I asked for performance. Quote from: denverI am using Lazarus to create a database application development framework which work in SaaS mode now. The Server Side is using ZeosLib, so it can connect to any database that zeoslib support. Interesting too. I'm curious how it works. Regards. ---------------------------------------------------------------------- denver · 2012-11-05 19:29 Quote from: Giu on November 05, 2012, 06:47:47 pm Quote from: denverI am using Lazarus to create a database application development framework which work in SaaS mode now. The Server Side is using ZeosLib, so it can connect to any database that zeoslib support. Interesting too. I'm curious how it works. Regards. Here is the link to download my work : http://www.francogrp.com/downloads/dgcli041.zip       for client - just check dgclient.conf to run the demo http://www.francogrp.com/downloads/dgsrv041.zip     for server - if you want to build your own server for fun ! My work is still under heavy development. The demo application is using MySQL 5.1. . I also tested with Orcale database too. Regards. ---------------------------------------------------------------------- ttomas · 2012-11-05 22:44 Quote from: Giu on November 05, 2012, 06:47:47 pmInteresting. I though something like forms and code embbebed in DLL/so and update from the server under demand. With this approach, and update, in CRM module for example, only needs one file to update. I didn't though about local data, My intentions was to access directly to database remoting, for this I asked for performance. Not only for performance, with local data, some systems like POS can work offline and synchronize to main database when internet connection is established. One my client have more than 20000 articles in store and frequently search/find articles in main database is waste of time and bandwidth.