 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Lorne Guest
|
Posted: Sat Sep 17, 2005 9:34 pm Post subject: What is the best way to do this? |
|
|
I want to write a program so that users go to a web site and they can
request to see data that is stored on a database that is stored on the web
server. This will be on a commercial ISP and not a dedicated corporate
server.
Each user can enter data about themselves that gets stored in the database
and can dictate who can see and who can't see that data.
Hence although users can edit their own database data they should not be
able to download it or open it in a database program like access and see
what others do not want them to see. They can see what others have put in
the database but only if the person entering the data has added them to
their list of valid viewers.
I am assuming Indy components can do what I want but I have only ever done
simple file reading with IdHTTP before and do not know where to start with
reading and writing to a database with Indy (I can do it in Delphi using
ADO). So my questions are:
What is the best way to go about this?
Which Indy components should I read about?
Are there any tutorials that may be useful?
How do I make sure the database is secure from those trying to read what
others want to keep private to a small group of users?
Many thanks if you can help.
|
|
| Back to top |
|
 |
Francois PIETTE [ICS - Mi Guest
|
Posted: Sun Sep 18, 2005 8:54 am Post subject: Re: What is the best way to do this? |
|
|
| Quote: | I want to write a program so that users go to a web site and they can
request to see data that is stored on a database that is stored on the web
server. This will be on a commercial ISP and not a dedicated corporate
server.
|
Do you want to write the server side program or the client side program, or
both ?
If you want to write the server side program using Delphi, you must have
your ISP running a Windows web server and allow you to run binary programs
(CGI or ISAPI) that extend the web server, or run an arbitrary binary that
listen on a given port. Most ISP doesn't allow either. Instead they allow
PHP or ASP and similar server side "scripting" language).
If you want to write the client side program, you may use any HTTP client
component such as HttpCli from ICS (http://www.overbyte.be) or IdHttp from
Indy.
--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[email]francois.piette (AT) overbyte (DOT) be[/email]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
|
|
| Back to top |
|
 |
Lorne Guest
|
Posted: Sun Sep 18, 2005 10:34 am Post subject: Re: What is the best way to do this? |
|
|
"Francois PIETTE [ICS - MidWare]" <francois.piette (AT) overbyte (DOT) be> wrote in
message news:432d2b6a$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I want to write a program so that users go to a web site and they can
request to see data that is stored on a database that is stored on the
web server. This will be on a commercial ISP and not a dedicated
corporate server.
Do you want to write the server side program or the client side program,
or both ?
If you want to write the server side program using Delphi, you must have
your ISP running a Windows web server and allow you to run binary programs
(CGI or ISAPI) that extend the web server, or run an arbitrary binary that
listen on a given port. Most ISP doesn't allow either. Instead they allow
PHP or ASP and similar server side "scripting" language).
If you want to write the client side program, you may use any HTTP client
component such as HttpCli from ICS (http://www.overbyte.be) or IdHttp from
Indy.
|
Thank you very much for your reply and link to your site. I think I want to
have a database file on the web and to write a client program that reads and
writes to/from the database but I can't see what Indy (or other) components
to use to write to/from a database that is on the web.
If the database was on the client or a LAN I would use TADOTable &
TDataSource to connect to it but what do I use to connect over the web?
Will the HttpCli component you mention do that? I can see from your site it
will read/post data but my specific question is whether it can insert data
into an existing database file in a recognised database format? The database
will be too large to download the file, insert data and then upload as many
users will have dial-up connections and the database will grow to over 1 Mb.
I do not want to use PHP/ASP as I have no knowledge of either at the moment
so I am trying to see if I can use my Delphi knowledge to do it and the only
gap is how to read/write to a database on the web. The only thing I have
ever done using Indy is to read a text file on the web using IdHTTP but
adding data to a field in a database or adding a record to the database is
something very different and I do not know where to start looking (unless
you tell me your components can do it).
Also, can I do this just by writing a client program and having nothing but
the database on the web or do I need something running on the web server as
well?
|
|
| Back to top |
|
 |
Francois PIETTE [ICS - Mi Guest
|
Posted: Sun Sep 18, 2005 11:43 am Post subject: Re: What is the best way to do this? |
|
|
| Quote: | I want to write a program so that users go to a web site and they can
request to see data that is stored on a database that is stored on the
web server. This will be on a commercial ISP and not a dedicated
corporate server.
Do you want to write the server side program or the client side program,
or both ?
If you want to write the server side program using Delphi, you must have
your ISP running a Windows web server and allow you to run binary
programs (CGI or ISAPI) that extend the web server, or run an arbitrary
binary that listen on a given port. Most ISP doesn't allow either.
Instead they allow PHP or ASP and similar server side "scripting"
language).
If you want to write the client side program, you may use any HTTP client
component such as HttpCli from ICS (http://www.overbyte.be) or IdHttp
from Indy.
Thank you very much for your reply and link to your site. I think I want
to have a database file on the web and to write a client program that
reads and writes to/from the database but I can't see what Indy (or other)
components to use to write to/from a database that is on the web.
If the database was on the client or a LAN I would use TADOTable &
TDataSource to connect to it but what do I use to connect over the web?
Will the HttpCli component you mention do that?
|
What you want to do require both a client and a server.
Let's talk about client first: being a "web" application, the natural client
is a Web Browser. But generally speaking, this client could be anything that
"talk" HTTP. So your client could be a Delphi program which make use of a
HTTP client component (THttpCli in ICS). With such a component you'll be
able to send request from your Delphi client program to the server just like
a browser would. You can "Get" some URL or "Post" some data.
| Quote: | I can see from your site it will read/post data but my specific question
is whether it can insert data into an existing database file in a
recognised database format?
|
I understand your question. So let's talk about the server side. A webserver
(That is a program which understand requests sent according to the HTTP
protocol and "execute" such requests, returning documents (usually HTML
files baut also any kind of document)) has no provision to access a
database. You have to write some code at server side. There are a lot of
possibilities fior that: PHP, ASP, ASPX, CGI, ISAPI, PERL and more. Whatever
language you select, the idea is to have an URL which when activated write
data to the database or read data from the database. Usually, this URL is a
HTML form's action. This URL is mapped by the webserver to some exention
depending on the language you selected. If you use Delphi, there are several
extension type available. I suggest you use either CGI or ISAPI (The first
is a simple EXE file while the other is a DLL). You could also write
WebService or complete standa alone application server.
When the webserver receive a URL request mapped to your extension, it launch
the EXE or the DLL and pass everuthing it knows: the URL and data posted
along with the URL, if any. Then your program (CGI-EXE or ISAPI-DLL) do
whatever it likes with the data using your usual database component to
read/write from/to your database located on the server. The main task of
this program, beside doing database I/O you need, is to return a valid HTTP
response to the webserver which in turn return it to the web client. This
valid HTTP respond is a document, probably a HTML file but could be a JPG or
GIF file, or anything else.
| Quote: | The database will be too large to download the file, insert data and then
upload as many users will have dial-up connections and the database will
grow to over 1 Mb.
|
With the programming model I explained above, you never download the
database. The client send requests, the server execute it and return some
result.
| Quote: | I do not want to use PHP/ASP as I have no knowledge of either at the
moment so I am trying to see if I can use my Delphi knowledge to do it and
the only gap is how to read/write to a database on the web.
|
As I said above, the eaisiest is to write a CGI or ISAPI extension.
Using Delphi: File / New / Other / New / WebServer application then select
ISAPI/NSAPI or CGI (or Apache Shared module which is the same as ISAPI but
for Apache server).
| Quote: | Also, can I do this just by writing a client program and having nothing
but the database on the web or do I need something running on the web
server as well?
|
You have to write both server and client side.
Use ICS HTTP client component at client side.
Use standard Delphi ISAPI/CGI/Whatever at server side, or use ICS HTTP
Server component to write your web application without even using a
webserver !
To select the best server side solution, you have to ask your hosting ISP
what kind of technology they allow. If you host yourself your application,
then you may select whatever your like most. To host it yourself, you just
need a permanent link to the internet with - preferably - a fixed IP; and of
course a computer with the required resources. Windows 2K or 2K3 _server_ is
mostly required unless you plan to have only a handful of simultaneous
clients.
--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[email]francois.piette (AT) overbyte (DOT) be[/email]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
|
|
| Back to top |
|
 |
Lorne Guest
|
Posted: Sun Sep 18, 2005 12:35 pm Post subject: Re: What is the best way to do this? |
|
|
Many thanks. It will take me some time to work through this but it is clear
to me now what I need to do.
"Francois PIETTE [ICS - MidWare]" <francois.piette (AT) overbyte (DOT) be> wrote in
message news:432d5300$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I want to write a program so that users go to a web site and they can
request to see data that is stored on a database that is stored on the
web server. This will be on a commercial ISP and not a dedicated
corporate server.
Do you want to write the server side program or the client side program,
or both ?
If you want to write the server side program using Delphi, you must have
your ISP running a Windows web server and allow you to run binary
programs (CGI or ISAPI) that extend the web server, or run an arbitrary
binary that listen on a given port. Most ISP doesn't allow either.
Instead they allow PHP or ASP and similar server side "scripting"
language).
If you want to write the client side program, you may use any HTTP
client component such as HttpCli from ICS (http://www.overbyte.be) or
IdHttp from Indy.
Thank you very much for your reply and link to your site. I think I want
to have a database file on the web and to write a client program that
reads and writes to/from the database but I can't see what Indy (or
other) components to use to write to/from a database that is on the web.
If the database was on the client or a LAN I would use TADOTable &
TDataSource to connect to it but what do I use to connect over the web?
Will the HttpCli component you mention do that?
What you want to do require both a client and a server.
Let's talk about client first: being a "web" application, the natural
client is a Web Browser. But generally speaking, this client could be
anything that "talk" HTTP. So your client could be a Delphi program which
make use of a HTTP client component (THttpCli in ICS). With such a
component you'll be able to send request from your Delphi client program
to the server just like a browser would. You can "Get" some URL or "Post"
some data.
I can see from your site it will read/post data but my specific question
is whether it can insert data into an existing database file in a
recognised database format?
I understand your question. So let's talk about the server side. A
webserver (That is a program which understand requests sent according to
the HTTP protocol and "execute" such requests, returning documents
(usually HTML files baut also any kind of document)) has no provision to
access a database. You have to write some code at server side. There are a
lot of possibilities fior that: PHP, ASP, ASPX, CGI, ISAPI, PERL and more.
Whatever language you select, the idea is to have an URL which when
activated write data to the database or read data from the database.
Usually, this URL is a HTML form's action. This URL is mapped by the
webserver to some exention depending on the language you selected. If you
use Delphi, there are several extension type available. I suggest you use
either CGI or ISAPI (The first is a simple EXE file while the other is a
DLL). You could also write WebService or complete standa alone application
server.
When the webserver receive a URL request mapped to your extension, it
launch the EXE or the DLL and pass everuthing it knows: the URL and data
posted along with the URL, if any. Then your program (CGI-EXE or
ISAPI-DLL) do whatever it likes with the data using your usual database
component to read/write from/to your database located on the server. The
main task of this program, beside doing database I/O you need, is to
return a valid HTTP response to the webserver which in turn return it to
the web client. This valid HTTP respond is a document, probably a HTML
file but could be a JPG or GIF file, or anything else.
The database will be too large to download the file, insert data and then
upload as many users will have dial-up connections and the database will
grow to over 1 Mb.
With the programming model I explained above, you never download the
database. The client send requests, the server execute it and return some
result.
I do not want to use PHP/ASP as I have no knowledge of either at the
moment so I am trying to see if I can use my Delphi knowledge to do it
and the only gap is how to read/write to a database on the web.
As I said above, the eaisiest is to write a CGI or ISAPI extension.
Using Delphi: File / New / Other / New / WebServer application then
select ISAPI/NSAPI or CGI (or Apache Shared module which is the same as
ISAPI but for Apache server).
Also, can I do this just by writing a client program and having nothing
but the database on the web or do I need something running on the web
server as well?
You have to write both server and client side.
Use ICS HTTP client component at client side.
Use standard Delphi ISAPI/CGI/Whatever at server side, or use ICS HTTP
Server component to write your web application without even using a
webserver !
To select the best server side solution, you have to ask your hosting ISP
what kind of technology they allow. If you host yourself your application,
then you may select whatever your like most. To host it yourself, you just
need a permanent link to the internet with - preferably - a fixed IP; and
of course a computer with the required resources. Windows 2K or 2K3
_server_ is mostly required unless you plan to have only a handful of
simultaneous clients.
--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[email]francois.piette (AT) overbyte (DOT) be[/email]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
|
|
|
| Back to top |
|
 |
tony Guest
|
Posted: Sun Sep 18, 2005 3:37 pm Post subject: Re: What is the best way to do this? |
|
|
| Quote: | If you host yourself your application,
then you may select whatever your like most. To host it yourself, you just
need a permanent link to the internet with - preferably - a fixed IP; and of
course a computer with the required resources. Windows 2K or 2K3 _server_ is
mostly required unless you plan to have only a handful of simultaneous
clients.
|
If you are going to host it yourself, windows should not be the first
choice, I would use Linux with apache and Postgresql as the backend
database. You can easily write server side apps using Kylix, and you
can even do them in the Delphi 7 IDE with CrossKylix.
Even if you don't host it yourself, find a ISP that uses linux, they
almost always allow you to run CGIs and provide database access, either
MySQL or Postgresql.
I use Interland's Linux solutions and for 29.00 dollars per month I get
everthing I need including full SSH access to my account and 5gb of data
transfer. I can also run CGI based webservices or plain CGIs created
with Kylix.
|
|
| Back to top |
|
 |
Francois PIETTE [ICS - Mi Guest
|
Posted: Sun Sep 18, 2005 4:14 pm Post subject: Re: What is the best way to do this? |
|
|
| Quote: | If you host yourself your application,
then you may select whatever your like most. To host it yourself, you
just need a permanent link to the internet with - preferably - a fixed
IP; and of course a computer with the required resources. Windows 2K or
2K3 _server_ is mostly required unless you plan to have only a handful of
simultaneous clients.
If you are going to host it yourself, windows should not be the first
choice, I would use Linux with apache and Postgresql as the backend
database.
|
Linux is not a good choice for a Delphi programmer.
Windows is perfect for hosting a web application.
Of course it has to be configured (and updated) correctly to avoid security
problems. Windows out of the box is risky but properly configured, it is OK.
If you don't know how to do that, buy the book "IIS Security" by Marty Jost
and Michael Cobb, published by Osborne Mc Graw Hill. It is a good book for
security beginners.
--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[email]francois.piette (AT) overbyte (DOT) be[/email]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|