You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by gi...@netscape.net on 2002/02/11 22:50:23 UTC

Multi-user problem (after some suggestions)

This is a bit of a repost, having followed some suggestions from my last post.

I haven't yet found a solution to my problem.  Most of you suggested that I replace my jdbc-odbc bridge driver with a better jdbc driver.  I've since replaced it with the Microsoft SQL Server jdbc beta 2 driver.  The behavior has not changed.  A few of you asked about my connection object and its scope and lifecycle, etc.  Below is a snipped copy of my original message, plus some code I'm using that partains to the database part..

If anyone wants more detail than this, I can combine and repost my last two messages.


   //------------------------------------------------------------
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException

    {
        //Various variable declarations omitted here

        //Database stuff
        Connection con;
        Statement query;
        ResultSet rs;


        response.setContentType("text/html");
        PrintWriter out = response.getWriter();

        //Omitted:
        //Get userid and password.  Abort if not provided.

        System.err.println("-----------------------");
        String ts;
        Enumeration en=request.getParameterNames();
        while (en.hasMoreElements()) {
        ts=(String) en.nextElement();
        System.err.println(ts+" = "+request.getParameter(ts));
        }
        System.err.println("-----------------------");



        //Open JDBC Connection
        try{
            //Old driver for jdbc/odbc bridge
            //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            //con = DriverManager.getConnection("jdbc:odbc:sqaa","sa","");

            //Use the spiffy new Microsoft SQL2k jdbc beta 2 driver
            Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
            con = DriverManager.getConnection("jdbc:microsoft:sqlserver://172.29.6.12:1433;DatabaseName=sqaa;user=sa");
            query = con.createStatement();
        }
        catch (Exception exc) {
            System.err.println("Error creating JDBC connection.");
            System.err.println(exc.getClass().getName());
            System.err.println(exc.getMessage());
            thelper.fileServe(out,"c:/html/except.html");
            return;
        }


gilmoresp@netscape.net wrote:

>I developed a system for reviewing scanned image quality.
>The system worked like a champ during development and on launch day.
>The next day, we went from 1 user to 2.
>The system is 100% intolerant of simultaneous requests.
>Anytime the second user makes a request before the first user's request is fulfilled, output stops and both requests are not fulfilled; The system is 'hung'.  
>Restarting Apache HTTP server resumes normal operation.
>The situation is easily reproducable.  Any ideas?
>
REPHRASED:  When the problem occurs, it seems that Apache doesn't pass the parameters (the name/value pairs that would be in the URL for a GET request) to tomcat, or so says my debug data..


>Apache 1.3 is a service on Windows 2000 running Tomcat 4 on the same server, with SQL server 2000 SP1 on the same server.  
>My system has 2 servlets, AUDREPORT and NEXTIMAGE.  AUDREPORT is run once per user at login.  
>NEXTIMAGE is called repeatedly (say 1000 to 3000 times per workshift per user).  

..Omitted old database info here ...

REPHRASED:
The user first sees a plain html document with a login form.  We never have problems with this document.  After submission, the user goes to a report page (the LOGIN servlet) which contains another form (just a submit button).  This page uses a database connection to generate the report.  The submit button loads the NEXTIMAGE servlet.  The nextimage servlet is called thousands of times after that.  A button on its output page calls itself iteratively.
Problems may occur if two simultaneous calls to NEXTIMAGE are made, or if simultaneous calls are made to LOGIN and NEXTIMAGE.
I'm not using connection pooling yet since there are only two users.  I may later, but not until this is fixed (unless it's the solution).  KISS, afterall :)
-- 




__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>