File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Cgi with Java" Watch "Cgi with Java" New topic

Cgi with Java


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
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at . 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.
Sean MacLean
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.
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
I agree. Here's the link:
subject: Cgi with Java
It's not a secret anymore!