This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Cgi with Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Cgi with Java" Watch "Cgi with Java" New topic
Author

Cgi with Java

anjana
Greenhorn

Joined: Jan 07, 2002
Posts: 2
Is it Possible to Connect Java Application to the DataBase using Cgi(instead of JDBC)?
If this is Possible could any body Post me an Example on How this could be Done(Querying, Inserting, Updating & Deleting Records) using Cgi with Java)
It is very Urgent.........
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
"anjana",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
Sean
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
I assume that you mean have a java web application call existing(?) perl dbi database modules? The answer depends on the interface that the cgi provides. If it is data access subroutines then you might be able to call them using runtime.exec("perl mycgi", new String[1]{"param1"}) perhaps. Or if the cgi has an http interface you might be able to have the servlet/jsp forward (like any other page forward) to the cgi so that it could parse the query data. However, if at all possible, I highly recommend an 'all java' solution using jdbc.
Sean
Aleksey Matiychenko
Ranch Hand

Joined: Apr 03, 2001
Posts: 178
First. CGI has nothing to do with database access. CGI- common gateway interface is roughly equivalent to Java Servlet API not JDBC.
You can use CGI to access database (by writing a perl script that used db access routines).CGI
I have not yet seen a reason to write a Java CGI application.
You might find some CGI classes on the net but I think you'd be better off writing JSP/Servlet with JDBC solution or a Perl/C/C++ CGI solution. I would not mix java and CGI.
Could you please elaborate on why would you want to write CGI in Java
 
GeeCON Prague 2014
 
subject: Cgi with Java