Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Remote connection to MYSQL
Tue, Mar 1 2016 12:45 AMPermanent Link

rbaroniunas

Baron Software

Avatar

I have tested on my machine the remote access to MYSQL using the MYSQL Query browser and made sure it could connect to my database.

Now with EWB 2.04 Build 1, I need to know why using DBISAM it does not connect remotely to MYSQL,

1. Can EWB connect remotely to a MYSQL database located on Hostgator web hosting so I can test it on my machine before deploying the result to the account.
2. I did not see any examples on how to execute from EWB a PHP call, do you have an example doing that ?  The 2 that come in the projects are PHP pages and not EWB so It is unclear how to interact with that.
Richard Baroniunas
Software Developer
Richard@Baronsoftware.com
Tue, Mar 1 2016 3:39 AMPermanent Link

Matthew Jones

rbaroniunas wrote:

> Now with EWB 2.04 Build 1, I need to know why using DBISAM it does
> not connect remotely to MYSQL,
>
> 1. Can EWB connect remotely to a MYSQL database located on Hostgator
> web hosting so I can test it on my machine before deploying the
> result to the account.  2. I did not see any examples on how to
> execute from EWB a PHP call, do you have an example doing that ?  The
> 2 that come in the projects are PHP pages and not EWB so It is
> unclear how to interact with that.

Hmm. DBISAM is an Elevate Software database product, and nothing to do
with MySQL or WebBuilder. Unless you already have data in DBISAM, it is
not relevant.

To access data on a server, you have to have something that is
responding to the appropriately formatted calls with appropriately
formatted data responses. That's the purpose of the PHP provided. I've
not looked at that myself - I use another web server technology.
However, Tim has said that the next update, due in March, will have a
significantly improved and much easier to use PHP example that would be
the better basis for accessing data on LAMP servers. Unless you are in
a hurry, you'd want to wait for that, though you could do development
in the IDE until it is ready of course. Reading up on the data
mechanisms would be a good backgrounder too.

--

Matthew Jones
Tue, Mar 1 2016 10:59 AMPermanent Link

Bruno Larochelle

only to 'second' Matthew..

1. Yes, you can do this, assuming you have some ability to do some PHP scripting on your 'Hostgator'.
2. Read (and re-read) the 'Using Datasets' in the Help file. Loads of information in there.
3. I have done this, quite easily (after step 2 Smile using PHP, connecting to MySQL. It is essentially the 'JSON broker' between the MySQL DB and the EWB web application.
4. EWB 2.05 .. might indeed be worth waiting for that, as there is mention of PHP connecting (search the forum for 2.05.. Tim Y has some notes on it)



"Matthew Jones" wrote:

rbaroniunas wrote:

> Now with EWB 2.04 Build 1, I need to know why using DBISAM it does
> not connect remotely to MYSQL,
>
> 1. Can EWB connect remotely to a MYSQL database located on Hostgator
> web hosting so I can test it on my machine before deploying the
> result to the account.  2. I did not see any examples on how to
> execute from EWB a PHP call, do you have an example doing that ?  The
> 2 that come in the projects are PHP pages and not EWB so It is
> unclear how to interact with that.

Hmm. DBISAM is an Elevate Software database product, and nothing to do
with MySQL or WebBuilder. Unless you already have data in DBISAM, it is
not relevant.

To access data on a server, you have to have something that is
responding to the appropriately formatted calls with appropriately
formatted data responses. That's the purpose of the PHP provided. I've
not looked at that myself - I use another web server technology.
However, Tim has said that the next update, due in March, will have a
significantly improved and much easier to use PHP example that would be
the better basis for accessing data on LAMP servers. Unless you are in
a hurry, you'd want to wait for that, though you could do development
in the IDE until it is ready of course. Reading up on the data
mechanisms would be a good backgrounder too.

--

Matthew Jones

Bruno Larochelle
Logiciels Bitwise Software
Edmonton, AB, Canada
Tue, Mar 1 2016 2:05 PMPermanent Link

rbaroniunas

Baron Software

Avatar

"Matthew Jones" wrote:

rbaroniunas wrote:

> Now with EWB 2.04 Build 1, I need to know why using DBISAM it does
> not connect remotely to MYSQL,
>
> 1. Can EWB connect remotely to a MYSQL database located on Hostgator
> web hosting so I can test it on my machine before deploying the
> result to the account.  2. I did not see any examples on how to
> execute from EWB a PHP call, do you have an example doing that ?  The
> 2 that come in the projects are PHP pages and not EWB so It is
> unclear how to interact with that.

Hmm. DBISAM is an Elevate Software database product, and nothing to do
with MySQL or WebBuilder. Unless you already have data in DBISAM, it is
not relevant.

To access data on a server, you have to have something that is
responding to the appropriately formatted calls with appropriately
formatted data responses. That's the purpose of the PHP provided. I've
not looked at that myself - I use another web server technology.
However, Tim has said that the next update, due in March, will have a
significantly improved and much easier to use PHP example that would be
the better basis for accessing data on LAMP servers. Unless you are in
a hurry, you'd want to wait for that, though you could do development
in the IDE until it is ready of course. Reading up on the data
mechanisms would be a good backgrounder too.

--

Matthew Jones

Wait a minute, where in the EWB manual does it discuss interfacing with PHP, there are the project samples but not much to go by.  It seems there is JSON interfacing and so on.

What i wanted to do was build a front end on my local machine, gaining a connection to MYSQL database to make sure the application works.  Apparently there are only 3 methods (elevatedb, DBISAM, ADO) and DBISAM is the method to use on Linux as far as I understand from the manuals.

Now getting a database connection is not the end of the world but where in the manual is a clear understanding of sending user information to a PHP page and retrieving information using JSON to populate the form ?

Richard Baroniunas
Software Developer
Richard@Baronsoftware.com
Tue, Mar 1 2016 2:17 PMPermanent Link

Raul

Team Elevate Team Elevate

<< Wait a minute, where in the EWB manual does it discuss interfacing
with PHP, there are the project samples but not much to go by.  It seems
there is JSON interfacing and so on. >>

Since EWB is javascript app one MUST connect thru a web service (using
JSON) to access ANY database. There is no specific PHP section in manual
(neither is there one for any other language) but all PHP samples
attempt to do is to implement the JSON spec
(http://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=DataSet_JSON_Reference).

EWB Web Server simply implements that JSON spec and allows
EDB/DBISAM/ADO database access.

<<
What i wanted to do was build a front end on my local machine, gaining a
connection to MYSQL database to make sure the application works.
Apparently there are only 3 methods (elevatedb, DBISAM, ADO) and DBISAM
is the method to use on Linux as far as I understand from the manuals.
>>

No DBISAM does not help you here. You still need a "web server" that EWB
app can talk to. I would suggest using EWB Web Server for now and then
once 2.05 ships Tim has promised to make the native PHP access lot easier.

<<
Now getting a database connection is not the end of the world but where
in the manual is a clear understanding of sending user information to a
PHP page and retrieving information using JSON to populate the form ?
>>

There is not - the back-end is completely abstracted using JSON and the
TDataset functionality in EWB. It does not really matter what the
back-end web server and database is (though it of course still needs to
be support the EWB JSON spec).

For example loading dataset data
(http://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=Creating_Loading_DataSets)
and then populating forms is always same on EWB app side.


Raul
Tue, Mar 1 2016 3:07 PMPermanent Link

rbaroniunas

Baron Software

Avatar

Raul wrote:

<< Wait a minute, where in the EWB manual does it discuss interfacing
with PHP, there are the project samples but not much to go by.  It seems
there is JSON interfacing and so on. >>

Since EWB is javascript app one MUST connect thru a web service (using
JSON) to access ANY database. There is no specific PHP section in manual
(neither is there one for any other language) but all PHP samples
attempt to do is to implement the JSON spec
(http://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=DataSet_JSON_Reference).

EWB Web Server simply implements that JSON spec and allows
EDB/DBISAM/ADO database access.

<<
What i wanted to do was build a front end on my local machine, gaining a
connection to MYSQL database to make sure the application works.
Apparently there are only 3 methods (elevatedb, DBISAM, ADO) and DBISAM
is the method to use on Linux as far as I understand from the manuals.
>>

No DBISAM does not help you here. You still need a "web server" that EWB
app can talk to. I would suggest using EWB Web Server for now and then
once 2.05 ships Tim has promised to make the native PHP access lot easier.

<<
Now getting a database connection is not the end of the world but where
in the manual is a clear understanding of sending user information to a
PHP page and retrieving information using JSON to populate the form ?
>>

There is not - the back-end is completely abstracted using JSON and the
TDataset functionality in EWB. It does not really matter what the
back-end web server and database is (though it of course still needs to
be support the EWB JSON spec).

For example loading dataset data
(http://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=Creating_Loading_DataSets)
and then populating forms is always same on EWB app side.


Raul

Thanks for the information that helps out.  

Now, if I had an excel spreadsheet or CSV that I wanted to use for the EWB application to read into the dataset for viewing purposes towards the end user, can i do that ?  Are there any examples of that if I could do it ?
Richard Baroniunas
Software Developer
Richard@Baronsoftware.com
Tue, Mar 1 2016 4:47 PMPermanent Link

Raul

Team Elevate Team Elevate

On 3/1/2016 3:07 PM, rbaroniunas wrote:
> Now, if I had an excel spreadsheet or CSV that I wanted to use for the EWB application to read into the dataset for viewing purposes towards the end user, can i do that ?  Are there any examples of that if I could do it ?

Richard,

Basic steps to do that are below.

I will use Excel ADO connection in this test since i never tried it before.

I definitely recommend in real use to use a proper database back end
(DBISAM/EDB in this case or MYSQL later). Proper database would require
you to load up the Excel/CSV into DB first.

Here goes excel sample. In my case data is in excel file opn first sheet
and 1st row is column headers.

A. Set up the data source in IDE
1. start EWBm, new project
2. In Dataset manager click the add (left icon with green arrow).

I configured it as follows:
1. Type : ADO
2. Name: MyExcel
3. ConnectionString: Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\raul\Documents\Elevate Web Builder
2\Projects\exceltest\testfile.xlsx;Extended Properties="Excel 12.0
Xml;HDR=YES";"

Make sure the test connection comes back as success

4. Row Source : Query : Select * from [Sheet1$]
5. Go to preview tab and you should see data - if not then config is not
valid


B. Add data source to form - have your form open and drag the "MyExcel"
from dataset manager to the form surface. it should create a new
TDataset object with columns etc already populated

C. Add grid - i'm using grid as simple display method. Note that EWB
controls are data aware so you can build a better user interface using
edit boxes, check boxes etc and link them to the same dataset in step B

1. drop the grid to form surface
2. set it's DateSet property to "MyExcel" - this should now
auto-populate the grid columns
3. You want to set the grid column widths here using object inspector
and possibly also do a proper grid layout but i'll skip it to keep it short

D. Add form "OnCreate" event and make it look like this :

procedure TForm1.Form1Create(Sender: TObject);
begin
   Database.Loadrows(myexcel);
end;


Compile and run and data should show up. Note that it's read-only at
this point since we have not done anything to support editing.

However other dataset setup and some UI layout the actual coding is only
1 line of code.

At this point this runs in IDE but it's verty simple to mnake it user
accessible.

You basically setup the data source in EWB Web server (it has import
button there that lets you import IDE datasets). Then you take the EWB
app and host it usinfg same EWB web server (basically put the compiled
EWB app to the web server content folder path) and run EWB web server.
The whole thing will be now browser accessible from any PC that can
access the EWB web server.

Hope this helps - let me know if you have any questions or if any steps
are unclear or don't work.

Raul
Wed, Mar 2 2016 1:28 PMPermanent Link

rbaroniunas

Baron Software

Avatar

Raul

Thanks for the Excel piece, I will use that but I am working on getting a back end for a Linux web server to perform maintenance on a MYSQL. I just need a simple example of a login form that is validated against the MYSQL account to allow access.

What I was thinking was to use EWB to create a simple but nice web site and use JSON to present the data to EWB by interfacing with the PHP pages.

Am I going with the wrong idea or can it be done with EWB ?
Richard Baroniunas
Software Developer
Richard@Baronsoftware.com
Wed, Mar 2 2016 2:00 PMPermanent Link

Raul

Team Elevate Team Elevate

On 3/2/2016 1:28 PM, rbaroniunas wrote:
> Thanks for the Excel piece, I will use that but I am working on getting a back end for a Linux web server to perform maintenance on a MYSQL. I just need a simple example of a login form that is validated against the MYSQL account to allow access.
> What I was thinking was to use EWB to create a simple but nice web site and use JSON to present the data to EWB by interfacing with the PHP pages.
> Am I going with the wrong idea or can it be done with EWB ?

Richard,

This is very doable in EWB.  If all you want to do it to validate user
login then you can even do something simpler:

1. EWB app that has the interface to get username and password

2. to validate those use server a request
(http://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=Executing_Request).
Easiest might just be to include the username/password as URL parameters
(but you can obviously use header fields or HTTP post payload etc)

3. The PHP script simply needs to extract the username/password (However
you decided to include them as per step 2) and then validate them
against MySQL. You can decide how you want to return this result  - as
http response code (200 vs 401) or always return 200 but include the
result in response text (as json or some simple strings indicating
success/failure).

4. EWB app then can check the result and proceed as you see fit (for
error likely just show user "login invalid" message).

Raul
Image