Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 18 total
Thread Database acces with native modules in EWB3
Mon, Jan 18 2021 1:43 PMPermanent Link

Ronald

Hi All,

In EWB2 I used an native module (Delphi) to do all the database work. The module returns datasets and posts data in dbisam tables. Authentication is also done with native modules.
In EWB2 I write:

Database.BaseURL:='/databasemodules/gdba';

"databasemodules" is a directory in the root of my website.
"gdba" is actually gdba.dll and does all the database work.

When I wanted to read a tabel in the webapplication I could write:

Database.LoadRows(tbSample);

The datasetname property of tbSample is dsSample.

This resulted in a call to the EWB webserver of:

http://localhost:6060/databasemodules/gdba?method=rows&database=sampledatabasename&dataset=ll_tiles

As you see the module gets all the information it needs to return the table (ll_tiles refers actually to a sql files that with the sql).

That works great, reliable and really fast.

***EWB3***

In EWB3 I want to use the same module. In the source I write:

Session.DatabaseResource:='databasemodules/gdba';
Session.UserName:='Anonymouse';
Database.DatabaseName:='sampledatabasename';

If I write Database.LoadRows(tbSample) I see this call is made:

http://localhost:6060/databasemodules/gdba/sampledatabasename/ll_tiles/data

This looks fine (although I am new to REST), I get the error "404 Resource not found".

What is wrong with my code?

Thanks,
Ronald



Mon, Jan 18 2021 6:03 PMPermanent Link

Raul

Team Elevate Team Elevate

On 1/18/2021 1:43 PM, Ronald wrote:

>
> In EWB3 I want to use the same module.

EWB3 is a major upgrade so you will need to at use new EWB3 component
and at the very least recompile and install updated native modules into
EWB3 server.

The default base URL for native modules is now also "modules" (i.e.
/modules) - edit server and look at Resources section


> If I write Database.LoadRows(tbSample) I see this call is made:
>
> http://localhost:6060/databasemodules/gdba/sampledatabasename/ll_tiles/data
>
> This looks fine (although I am new to REST), I get the error "404 Resource not found".
>
> What is wrong with my code?

Did you change EWB3 server native module path to be databasemodules ?


I'm looking at changes myself right now but basically start from here:

https://www.elevatesoft.com/manual?action=topics&id=ewb3&section=using_the_web_server

and native modules are described  here

https://www.elevatesoft.com/manual?action=viewtopic&id=ewb3&topic=Server_Modules

I believe in general you need to do
- recompile your modules using EWB3 Modules (and make other changes in
code to make sure it all works in REST model)
- add your compiled module and install in EWB server
- then use "/modules" path to access from app

Raul
Tue, Jan 19 2021 10:45 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ronald,

<< In EWB3 I want to use the same module. In the source I write:

Session.DatabaseResource:='databasemodules/gdba';
Session.UserName:='Anonymouse';
Database.DatabaseName:='sampledatabasename';

If I write Database.LoadRows(tbSample) I see this call is made:

http://localhost:6060/databasemodules/gdba/sampledatabasename/ll_tiles/data

This looks fine (although I am new to REST), I get the error "404 Resource not found". >>

If you don't want to use the default resource name of "modules" for the native server modules resource name, then you need to change it on the server, also.  You can do this by editing the Internal web server (or any other web server):

https://www.elevatesoft.com/manual?action=viewtopic&id=ewb3&topic=Using_Server_Manager

For the Internal web server, editing the resource names changes how both the IDE/server manager and web server handle the resources.  For all other (external) web servers, editing the resource names only changes how the IDE/server manager handles the resources, and you will need to configure the web server manually using the ewbsrvr.ini file:

https://www.elevatesoft.com/manual?action=viewtopic&id=ewb3&topic=Configuring_Server

Also, if you drag and drop a server from the server manager on to a form/database designer in order to create a new TServerSession instance, remember that these resource names are *not* updated automatically if you subsequently change the resource names using the server manager in the IDE.

In order to get your module working with the new architecture and the default settings, you will need the following code:

Session.DatabaseResource:='modules';
Session.UserName:='Anonymous';
Database.DatabaseName:='sampledatabasename';

And then your module will need to make sure to handle the database name *prior* to calling the HandleRequest method using the TEWBDatabaseAdapter:

https://www.elevatesoft.com/manual?action=viewmethod&id=ewb3mod&product=rsdelphiwin32&version=10.4&comp=TEWBDatabaseAdapter&method=HandleRequest

You can use the incoming request's RequestPathComponents property to examine the various parts of the incoming URL:

https://www.elevatesoft.com/manual?action=viewprop&id=ewb3mod&product=rsdelphiwin32&version=10.4&comp=TEWBServerRequest&prop=RequestPathComponents

in order to determine the database name and pass it to the HandleRequest method.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jan 19 2021 2:08 PMPermanent Link

Ronald

Thanks Raul and Tim,

<
Tim Young [Elevate Software] wrote:

In order to get your module working with the new architecture and the default settings, you will need the following code:

Session.DatabaseResource:='modules';
Session.UserName:='Anonymous';
Database.DatabaseName:='sampledatabasename';
>

How does the webserver "know" that it should call the module with the name "gdba"?

Ronald
Tue, Jan 19 2021 2:50 PMPermanent Link

Raul

Team Elevate Team Elevate

On 1/19/2021 2:08 PM, Ronald wrote:
>
> How does the webserver "know" that it should call the module with the name "gdba"?
>

I believe it uses the name you supply when installing a module - install
requires the name and dll file.

If you name it "gdba" this should correspond to url path of
"/modules/gdba" and routed to the dll when request comes in

Raul
Wed, Jan 20 2021 4:35 AMPermanent Link

Ronald

Raul wrote:

<
If you name it "gdba" this should correspond to url path of
"/modules/gdba" and routed to the dll when request comes in
>

There is more then 1 module in the directory, so I assume I have to explicitly tell the server which module to call.
But if I do Session.DatabasesResource:='modules/gdba' then I get the error:

Dataset load response error (The servermodule gdba/sampledatabase/ll_tiles/data does not exist)

How do i tell the server to call the module gdba (gdba.dll)?

Ronald
Wed, Jan 20 2021 9:08 AMPermanent Link

Raul

Team Elevate Team Elevate

On 1/20/2021 4:35 AM, Ronald wrote:
> There is more then 1 module in the directory, so I assume I have to explicitly tell the server which module to call.
> But if I do Session.DatabasesResource:='modules/gdba' then I get the error:
>
> Dataset load response error (The servermodule gdba/sampledatabase/ll_tiles/data does not exist)
>
> How do i tell the server to call the module gdba (gdba.dll)?

Did you install the module (using server manager in IDE) ?

During the install you specify name and the DLL file which should create
the association


Raul



Attachments: 2021-01-20_9-05-37.jpg
Wed, Jan 20 2021 9:31 AMPermanent Link

Ronald

Raul wrote:

<
Did you install the module (using server manager in IDE) ?
>

Yes, the module is installed using the server manager.
In the modules directory on the server there are several .dll files. They are installed with the server manager.

So the question remains How does the server know that it should use gdba.dll?
Or am I understanding it incorrectly, can there be only 1 module in the module directory?

Ronald
Wed, Jan 20 2021 10:14 AMPermanent Link

Raul

Team Elevate Team Elevate

On 1/20/2021 9:31 AM, Ronald wrote:
> Yes, the module is installed using the server manager.
> In the modules directory on the server there are several .dll files. They are installed with the server manager.
>
> So the question remains How does the server know that it should use gdba.dll?
> Or am I understanding it incorrectly, can there be only 1 module in the module directory?

By the installed name. Number of DLLs does not matter.

Server will let you register the name only one once and it can point to
only one dll - that's the association.

Raul
Wed, Jan 20 2021 10:41 AMPermanent Link

Ronald

Raul wrote:

<Server will let you register the name only one once and it can point to
only one dll - that's the association.>

In the call to the server that name is never used. Tim advices to use this:

Session.DatabaseResource:='modules';
Session.UserName:='Anonymous';
Database.DatabaseName:='sampledatabasename';

Where is gdba mentioned above? The dll should be associated with the database call somehow.
Page 1 of 2Next Page »
Jump to Page:  1 2
Image