Solved

CGI + databases + java

Posted on 1998-11-10
1
229 Views
Last Modified: 2013-12-25
I'am making a programa in Java (applets) Client-Server.
The users access the systems with their browsers.
First they call an HTML initial page then
I have another pages wich have a Menu with options wich access
to the DataBases.
One option in the program is List the elements of a table.
What I want is list the elements of the table and Display them
in a HTML Table,
Somebody told me that this is possible that it is possible to
write server-side java (SERVLETS) or with CGI
JDBC offers possibilities to access databases.
but I really don't know how to do it.
Can Anybody give me THE CODE wich I have to write to do this?

Extra Information:

What I need is that the server send me a HTML page
having a table with the result of the SQL question.
The final objetive of that table is that the user
can send it to the Printer.
 I need to send this result to the
Printer so the easy way for me to do this is that the
server send me the results in a HTML page.
PD: I don´t know nothing of CGI so please be as clear as possible
0
Comment
Question by:Pampa
1 Comment
 
LVL 5

Accepted Solution

by:
aioudine earned 120 total points
ID: 1829525
You may acces database by using two method:

1) Applet on client workstation worked as RMI client
Java apllication (not servlet) worked in as RMI server
Applet send request to RMI server, RMI server access database using JDBC and return
result to RMI applet

see http://javaboutique.internet.com/article_Bi-Directional_RMI.html
for more info about RMI

2) On clent side you use just a <FORM> which send CGI request to server
On server you run SERVLET, which access database using JDBC or thin database driver
result returnes to client as HTML page

IMHO, servlet is better solution, becouse you may access DB from any browser,
without java on client side
--------
How to do this?
First you should learn what is servelet and how they work
read  "Goodbuy CGI, Say Hello to servlet"
thttp://www.webreview.com/97/10/10/feature/
and see links at bootom

Second downoad JSDK (java servlet developers kit)
JSDK available for downloading from http://www.javasoft.com
(Click on product&API then go to "Servlet developers kit")


Third Install Servlet support for youre web server
many webservers embed support for Servlet (Like Netscape, servers, Tengah Weblogic,
SUN JavaWebserver, O'reilly WebSite Pro, NewAtlanta's ServletExec)
JSDK also included support for IIS and Apache

If youre servler not listed or you wish to use more robust solution
look for JRUN, product available from Live Software at http://www.jrun.com/
(Free lite version available for free)

for testing purpose JSDK also included srun - small program whitch allow to run and test servlet without webserver (Say on Win95 computer)
--------
As far as you are newbie I recommend you download JSDK from sun
install it on Win95 mashine and play with it



Articles "Introduction to Database Programming with Servlets" available from ServletCentral at
http://www.servletcentral.com/1998-10/colton.dchtml
(Source code included)


Additional information:
1) Servlet training availble at http://www.nova-labs.com/
2) Weblogic Tengah (servlet application server with database support):  http://www.weblogic.com
3) Javasoft home: http://www.javasoft.com
4) ServletCentral (Articles, resourses, review etc): http://www.servletcentral.com
5) ServletSource(Tips. tutorials etc): http://www.servletsource.com/
6) Article "Java DataBase Connectivity" with examples :  http://www.berger.com/jdbcpres.html
7) Introduction to JDBC programming at http://www.suite101.com/articles/article.cfm/1956
8) "Java meet CGI"  at http://www.webdeveloper.com/categories/java/java_meets_cgi.html
9)  "Comparison of JDBC and Java to HTML/CGI"
http://www.cariboulake.com/techinfo/java_html.html
10) "Java Apache Project" http://jserv.apache.org/
11) Disccusion transcript from JAvaOne
"Programming the Java Servlet API"
http://sunsite.compapp.dcu.ie/IJUG/javaone/transcripts/program.html






0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now