----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Hi guys,

I've got Apache JServ 1.1b2 talking to MySQL okay (using
mm.mysql.jdbc-2.0pre/mysql_1_uncomp.jar with IBM JDK 1.1.8 on Linux),
except where I try to do this in servlet init().  When I use the code in
init() (attached below), the browser just sits there waiting for a
reply.

mod_jserv.log contains nothing.  jserv.log contains:

[27/10/1999 20:33:06:191 EST] hSearch: started
[27/10/1999 20:44:13:688 EST] Timeout for servlet hSearch expired.
Probable deadlock. Skipping destroy().

I remember reading about someone else having probs in init() like me,
but can't find those messages now.

Any thoughts?

thanks in anticipation,

Harry


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;

public class hSearch extends HttpServlet
{

                public String[] fieldNames;
                public int numCols;

                public void init(ServletConfig config) throws ServletException
                {

                        super.init(config);  

                        fieldNames = new String[100];
                        String tmp;


                try {
 
                Class.forName ("org.gjt.mm.mysql.Driver").newInstance();
    
                Connection conTMP = DriverManager.getConnection
("jdbc:mysql://localhost/db?user=dbman&password=easilyguessed");
                Statement stmtTMP = conTMP.createStatement ();
                String queryTMP = "SELECT * FROM InterestingTable WHERE 1=2;";
                ResultSet rsTMP = stmtTMP.executeQuery (queryTMP);
                numCols = rsTMP.getMetaData().getColumnCount ();
                //Now read the names into an array
                for (int i=1; i<=numCols; i++) {  
                        tmp=rsTMP.getMetaData().getColumnName(i).toString();
                        fieldNames[i]= new String(tmp); 
                }
                rsTMP.close();
                stmtTMP.close();
                conTMP.close();
                }
                        catch (SQLException ex) 
                        {
                while (ex != null) 
                {
                    System.out.println ("SQL Exception:  " +
                            ex.getMessage ());
                    ex = ex.getNextException ();
                }
            }
            catch (java.lang.Exception ex) {
                    ex.printStackTrace ();
            }                   
                
                }


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to