• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cgi with Java

 
anjana
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic