You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Mark W. Webb" <ma...@dolphtech.com> on 2003/06/09 21:33:37 UTC

question on creating a file download servlet

I need to write a servlet that handles file downloads, so that I can audit who downloaded from where, when..etc.  

When I click on the link to download a file, the "Save As" window comes up in my browser(Netscape), and as a default filename I get the servlet name.  Is there a way to list the actual filename in the "Save As" window ?



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


[OT] Re: What Oracle is best?

Posted by Jason Bainbridge <ja...@jblinux.org>.
Oracle is an enterprise level commercial Database Management System ie. $$$ 
where MySQL is an Open Source alternative designed mainly for web application 
uses (although this may change with their partnership with SAP).  These 
DBMS's can be used within servlets and JSP's by using the appropriate JDBC 
driver.

I believe the current release of Oracle is 9iR2, if you have a requirement to 
use Oracle you would want to look into using that version but it isn't just a 
download and install type affair, there are licenses to worry about and the 
actual install can be a real pain at times.

Do you want to just use a database backend for your web application? In that 
case you're best of with MySQL or PostgresSQL depending on what sort of 
featureset you require.

Regards,
-- 
Jason Bainbridge
http://jblinux.org

On Tue, 10 Jun 2003 03:36, Jonathan Michael Nowacki wrote:
> Just wondering what kind of oracle programs do I need to get Tomcat to
> access an SQL database.  I have servlets already written that work on
> another Sun OS machine that I still have access to.  Is there a way I can
> query the OS to find out what versions of oracle are installed?  The RPM
> command obviously doesn't work (since it is a Sun OS), and I don't have
> root permissions of course.
>     If I can't query the Sun OS what versions of Oracle do you recommend.
> I tried browsing the oracle homepage and google searches but that just
> made me more confused from the vast number of choices.  Also do I need
> sqlplus or JDBC if I have j2sdk, tomcat, and MySQL?
>
>
> This is whats already installed:
> -----------------------------------------------
> tomcat4-webapps-4.1.24-full.2jpp
> tomcat4-4.1.24-full.2jpp
> tomcat4-admin-webapps-4.1.24-full.2jpp
> j2re1.4.1_02
> j2sdkee1.4
> j2sdk1.4.1_02
> redhat 8
> standard MySQL that comes with Redhat 8 Linux
>
>
>
> Sample Servlet code that works on another computer
> ----------------------------------------------------
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.*;
> import java.util.*;
> import java.sql.*;
> public class MultiServlet extends HttpServlet {
>   /**
>    * Initialize global variables
>    */
>   public void init(ServletConfig config) throws ServletException {
>     super.init(config);
>   }
>   /**
>    * Process the HTTP Post request
>    */
>   public void doPost(HttpServletRequest request, HttpServletResponse
> response)
>         throws ServletException, IOException {
>
>     String category = request.getParameter("category");
>
>     response.setContentType("text/html");
>     PrintWriter out = new PrintWriter (response.getOutputStream());
>     out.println("<html>");
>     out.println("<head><title>Advanced Search</title></head>");
>     out.println("<body><table border=1 cellpadding = 5 cellspacing = 0>");
>
>     try
>     {
> System.out.println ("\n before registering driver \n");
>       DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
> System.out.println (" before GET Connection  \n");
>       Connection conn = DriverManager.getConnection
> ("jdbc:oracle:thin:@dbserv.uits.indiana.edu:1521:OED1","s3jm013","s3jm013")
>; System.out.println (" before STatement  \n");
>       Statement stmt = conn.createStatement();
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: What Oracle is best?

Posted by Michael Duffy <du...@yahoo.com>.
I believe you'd just need the JDBC driver jars.  I'm
connecting to Oracle from a servlet, and that's all
I'm using.  

Installing the Oracle client SQL-Plus might be helpful
for working directly with the database tables, but
it's not necessary if someone else has already done
that for you.  

You don't need TNSNAMES or the client - just the thin
driver URL, the same way you've spelled it out in the
example you provided.

I think the most current version of Oracle is 9.2.0.1.

MySQL is another flavor of database, so you don't need
that if you have Oracle.  Each database will have its
own JDBC drivers, so you'll need to get them from the
database vendor for your version.

Just put the JDBC jars in the TOMCAT_HOME/common/lib
directory and you're good to go.


--- Jonathan Michael Nowacki <jn...@indiana.edu>
wrote:
> Just wondering what kind of oracle programs do I
> need to get Tomcat to
> access an SQL database.  I have servlets already
> written that work on
> another Sun OS machine that I still have access to. 
> Is there a way I can
> query the OS to find out what versions of oracle are
> installed?  The RPM
> command obviously doesn't work (since it is a Sun
> OS), and I don't have 
> root permissions of course.  
>     If I can't query the Sun OS what versions of
> Oracle do you recommend.
> I tried browsing the oracle homepage and google
> searches but that just
> made me more confused from the vast number of
> choices.  Also do I need
> sqlplus or JDBC if I have j2sdk, tomcat, and MySQL?
> 
> 
> This is whats already installed:
> -----------------------------------------------
> tomcat4-webapps-4.1.24-full.2jpp
> tomcat4-4.1.24-full.2jpp
> tomcat4-admin-webapps-4.1.24-full.2jpp
> j2re1.4.1_02
> j2sdkee1.4
> j2sdk1.4.1_02
> redhat 8
> standard MySQL that comes with Redhat 8 Linux
> 
> 
> 
> Sample Servlet code that works on another computer
> ----------------------------------------------------
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.*;
> import java.util.*;
> import java.sql.*;
> public class MultiServlet extends HttpServlet {
>   /**
>    * Initialize global variables
>    */
>   public void init(ServletConfig config) throws
> ServletException {
>     super.init(config);
>   }
>   /**
>    * Process the HTTP Post request
>    */
>   public void doPost(HttpServletRequest request,
> HttpServletResponse
> response) 
>         throws ServletException, IOException {
> 
>     String category =
> request.getParameter("category");
> 
>     response.setContentType("text/html");
>     PrintWriter out = new PrintWriter
> (response.getOutputStream());
>     out.println("<html>");
>     out.println("<head><title>Advanced
> Search</title></head>");
>     out.println("<body><table border=1 cellpadding =
> 5 cellspacing = 0>");
> 
>     try
>     {
> System.out.println ("\n before registering driver
> \n");
>       DriverManager.registerDriver(new
> oracle.jdbc.driver.OracleDriver());
> System.out.println (" before GET Connection  \n");
>       Connection conn = DriverManager.getConnection
>
("jdbc:oracle:thin:@dbserv.uits.indiana.edu:1521:OED1","s3jm013","s3jm013");
> System.out.println (" before STatement  \n");
>       Statement stmt = conn.createStatement();
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


What Oracle is best?

Posted by Jonathan Michael Nowacki <jn...@indiana.edu>.
Just wondering what kind of oracle programs do I need to get Tomcat to
access an SQL database.  I have servlets already written that work on
another Sun OS machine that I still have access to.  Is there a way I can
query the OS to find out what versions of oracle are installed?  The RPM
command obviously doesn't work (since it is a Sun OS), and I don't have 
root permissions of course.  
    If I can't query the Sun OS what versions of Oracle do you recommend.
I tried browsing the oracle homepage and google searches but that just
made me more confused from the vast number of choices.  Also do I need
sqlplus or JDBC if I have j2sdk, tomcat, and MySQL?


This is whats already installed:
-----------------------------------------------
tomcat4-webapps-4.1.24-full.2jpp
tomcat4-4.1.24-full.2jpp
tomcat4-admin-webapps-4.1.24-full.2jpp
j2re1.4.1_02
j2sdkee1.4
j2sdk1.4.1_02
redhat 8
standard MySQL that comes with Redhat 8 Linux



Sample Servlet code that works on another computer
----------------------------------------------------
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
public class MultiServlet extends HttpServlet {
  /**
   * Initialize global variables
   */
  public void init(ServletConfig config) throws ServletException {
    super.init(config);
  }
  /**
   * Process the HTTP Post request
   */
  public void doPost(HttpServletRequest request, HttpServletResponse
response) 
        throws ServletException, IOException {

    String category = request.getParameter("category");

    response.setContentType("text/html");
    PrintWriter out = new PrintWriter (response.getOutputStream());
    out.println("<html>");
    out.println("<head><title>Advanced Search</title></head>");
    out.println("<body><table border=1 cellpadding = 5 cellspacing = 0>");

    try
    {
System.out.println ("\n before registering driver \n");
      DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
System.out.println (" before GET Connection  \n");
      Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@dbserv.uits.indiana.edu:1521:OED1","s3jm013","s3jm013");
System.out.println (" before STatement  \n");
      Statement stmt = conn.createStatement();



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org