Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread choose/change database at runtime
Fri, Jun 19 2015 6:33 AMPermanent Link

Luis Conception Gonzalez

Hi!

I downloaded and installed Elevate Web Builder yesterday, and I'm trying it. I have been able to configure a web server and make a simple application that connects to a predefined database/datasets. Works perfect in both EWS IDE and in my browsers.

Now I have a few questions...

1. The application I try to develop needs to let end-users choose which database they will connect to, so I need to set it up at runtime. Is it posible?

With this option, I can install the web server in my own PC or web page, and end-users could access it and choose which database connects to specifying their publi IP. I did something similar with Embarcadero HTML5 Builder, PHP and ODBC DBISAM: http://www.sgweb.es/unit1.php

2. If option 1 is not posible... Web Server and App must be installed in customer's PC, but... How can I configure the customer's web server 'by code' so he doesn't need to see, execute nor configure it manually?

3. Is it posible to download EWS 2 Trial, or where can I read the new features?

Thanks!

Luis Concepcion
Fri, Jun 19 2015 7:11 AMPermanent Link

Matthew Jones

Luis Conception Gonzalez wrote:

> 2. If option 1 is not posible... Web Server and App must be installed
> in customer's PC, but... How can I configure the customer's web
> server 'by code' so he doesn't need to see, execute nor configure it
> manually?
>
> 3. Is it posible to download EWS 2 Trial, or where can I read the new
> features?

I can't answer question 1 - I suspect it may be beyond the remit of the
basic server, but I've only really looked at it once and found it was
quite impressive for what it is designed to do. But to answer 3 first,
Tim has said the trial will be out when the release happens, and that
is any time now. You can buy the product today to get access to the
preview, which is very good already. But I'm mainly wanting to say that
by doing your own web server, you can do anything you want with
databases. This includes running the server on your customer's own PC -
I do this with our "Connect" product which runs on any Windows laptop
and serves mobile devices with the EWB application. In that case, my
server is not actually using a database at all, but a number of XML
files, but since it is all up to you, it can do anything. I use the
RemObject SDK for my server (see previous mentions), but you can use
anything you want to provide the API and the data feeds.


--

Matthew Jones
Fri, Jun 19 2015 8:01 AMPermanent Link

Ronald

The problem could indeed be in the MaxAge in the manual it says:

....the MaxAge parameter specifies the length of time, in seconds..

But I have not tested it, because you gave me a good idea (as usual) about
the localstorage. I tried that and it works great.


"Matthew Jones"  schreef in bericht
news:E8C18327-5642-4906-9169-B9C1287BADDB@news.elevatesoft.com...

Luis Conception Gonzalez wrote:

> 2. If option 1 is not posible... Web Server and App must be installed
> in customer's PC, but... How can I configure the customer's web
> server 'by code' so he doesn't need to see, execute nor configure it
> manually?
>
> 3. Is it posible to download EWS 2 Trial, or where can I read the new
> features?

I can't answer question 1 - I suspect it may be beyond the remit of the
basic server, but I've only really looked at it once and found it was
quite impressive for what it is designed to do. But to answer 3 first,
Tim has said the trial will be out when the release happens, and that
is any time now. You can buy the product today to get access to the
preview, which is very good already. But I'm mainly wanting to say that
by doing your own web server, you can do anything you want with
databases. This includes running the server on your customer's own PC -
I do this with our "Connect" product which runs on any Windows laptop
and serves mobile devices with the EWB application. In that case, my
server is not actually using a database at all, but a number of XML
files, but since it is all up to you, it can do anything. I use the
RemObject SDK for my server (see previous mentions), but you can use
anything you want to provide the API and the data feeds.


--

Matthew Jones
Fri, Jun 19 2015 9:30 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

To do this I wrote my own simple web server and each user passed in  a
User name and Password (setup in the TDatabase component). I then used
this to read their corresponding server IP address and connection
details from a local table (i.e. same server as the Web Server) and then
used these details to carry out the HttpRequest.

Chris Holland
[Team Elevate]

On 19/06/2015 11:33, Luis Conception Gonzalez wrote:
> Hi!
>
> I downloaded and installed Elevate Web Builder yesterday, and I'm trying it. I have been able to configure a web server and make a simple application that connects to a predefined database/datasets. Works perfect in both EWS IDE and in my browsers.
>
> Now I have a few questions...
>
> 1. The application I try to develop needs to let end-users choose which database they will connect to, so I need to set it up at runtime. Is it posible?
>
> With this option, I can install the web server in my own PC or web page, and end-users could access it and choose which database connects to specifying their publi IP. I did something similar with Embarcadero HTML5 Builder, PHP and ODBC DBISAM: http://www.sgweb.es/unit1.php
>
> 2. If option 1 is not posible... Web Server and App must be installed in customer's PC, but... How can I configure the customer's web server 'by code' so he doesn't need to see, execute nor configure it manually?
>
> 3. Is it posible to download EWS 2 Trial, or where can I read the new features?
>
> Thanks!
>
> Luis Concepcion
>
Sat, Jun 20 2015 8:24 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Luis,

<< 1. The application I try to develop needs to let end-users choose which
database they will connect to, so I need to set it up at runtime. Is it
possible? >>

Yes, but you'll need to build a custom dataset module to handle this.  It's
not particularly hard, but it will require coding of a web server module for
the EWB Web Server.  With EWB 2, you can use such modules in the IDE, so
it's easier to work with the datasets surfaced by the such modules at
design-time.

http://www.elevatesoft.com/manual?action=topics&id=ewb2mod&product=rsdelphi&version=XE&section=getting_started

There is an example dataset module included with EWB 2, and I'll be adding
more module examples.  EWB 1.x was very skimpy on examples in this
department.

Essentially you'll add a "database" parameter to the global TDatabase
instance's Params property:

http://www.elevatesoft.com/manual?action=viewprop&id=ewb2&comp=TDatabase&prop=Params

Database.Params.Add('database=mydatabase');

This parameter will get sent over to your dataset module for every request,
and you can use it to determine which database to use with all of the
dataset adapters.  Here's the EWB 2 dataset module example modified to allow
for a specific database:

unit main;

interface

uses SysUtils, Classes, DB, ewbhttpmodule, ewbdatasetadapter, edbcomps;

type
 TExampleDataSetModule = class(TEWBModule)
   DatabaseAdapter: TEWBDatabaseAdapter;
   BiolifeAdapter: TEWBDataSetAdapter;
   BiolifeSession: TEDBSession;
   BiolifeDatabase: TEDBDatabase;
   Biolife: TEDBTable;
   procedure EWBModuleExecute(Request: TEWBServerRequest);
   procedure BiolifeAdapterInitialize(Adapter: TEWBDataSetAdapter);
   procedure DatabaseAdapterGetDataSetAdapter(const DataSetName: string;
     var Adapter: TEWBDataSetAdapter);
   procedure EWBModuleCreate(Sender: TObject);
   procedure EWBModuleDestroy(Sender: TObject);
   procedure BiolifeAdapterFilterRows(Adapter: TEWBDataSetAdapter;
     Request: TEWBServerRequest);
   procedure DatabaseAdapterAuthenticateUser(const RequestUserName,
     RequestPassword: string; var Authenticated: Boolean);
 private
   DatabaseToUse: String;  // member variable to hold database name
   procedure SetupSession;
 public
   { Public declarations }
 end;

..............

procedure TExampleDataSetModule.DatabaseAdapterGetDataSetAdapter(
 const DataSetName: string; var Adapter: TEWBDataSetAdapter);
begin
  BiolifeDatabase.Database:=DatabaseToUse; // Use database name
  BiolifeDatabase.Connected:=True;
  if AnsiSameText(DataSetName,'Biolife') then
     begin
     BiolifeAdapter.DataSet.Open;
     BiolifeAdapter.Initialize;
     Adapter:=BiolifeAdapter;
     end
  else
     Adapter:=nil;
end;

procedure TExampleDataSetModule.EWBModuleExecute(Request:
TEWBServerRequest);
begin
  DatabaseToUse:=Request.RequestParams['database'];  // Read in database
name
  DatabaseAdapter.HandleRequest(Request,'customdatasets');
end;

initialization
  with edbcomps.Engine do
     begin
     CharacterSet:=csAnsi;
     ConfigMemory:=True;
     TempTablesPath:=OSTempDirectory;
     UseLocalSessionEngineSettings:=True;
     Active:=True;
     end;
end.

If you're starting a new project, then you definitely want to skip over EWB
1.x and go right to EWB 2.  A trial version will be available on Monday,
which is when it will (finally) be released.

Tim Young
Elevate Software
www.elevatesoft.com
Image