i don't get any error when there isn't that much traffic

but i dont close my jdbc connections, could that be a problem?

this is the function i use to query

----------------------------------------------------------------------------------------
public ResultSet getData(String queryStr) throws Exception
        {

                try {
                        DBConstants db = new DBConstants();
                        Class.forName(db.getDrivername());
                        Connection conn;
conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://" + db.getHostname() + "","" + db.getUsername() + "","" + db.getPassword() + "");


                        Statement stmt = conn.createStatement();
                        ResultSet rs = stmt.executeQuery(queryStr);
                        return rs;
                }
                catch(Exception e) {
                        e.printStackTrace();
                        System.out.println("getData error");
                        throw new Exception();
                }
        }
----------------------------------------------------------------------------------

then if i want to use it in a jsp page i will do something like this
------------------------------------------------------------------------

<%
 DBPoolBean dbpb = new DBPoolBean();

ResultSet rs = dbpb.getData("SELECT * FROM drops order by hnm, itemname_en");
 while ( rs.next() ) {
   out.println("<tr><td width=\"50\">" + rs.getString("hnm") + " </td>");
out.println("<td width=\"50\">" + rs.getString("itemname_en") + " </td></tr>");
 }
%>



From: Darek Czarkowski <[EMAIL PROTECTED]>
Reply-To: "Tomcat Users List" <users@tomcat.apache.org>
To: Tomcat Users List <users@tomcat.apache.org>
Subject: Re: web application - student need help
Date: Fri, 05 Jan 2007 12:52:19 -0800

Michael Ni wrote:

the web application uses simple queries, like search a table for a certain condition. i realize when multiple people access the database it hangs, and causes the jsp pages to error.
Just a guess, your connection to the database is a problem, perhaps errors in queries, not closed connections.
What are the error messages? (page/log)

--
Darek Czarkowski
Ph: 604 294 6557 (Ext. 113)
Fx: 604 294 6507
www.infinitesource.ca
darekc at infinitesource dot ca


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Type your favorite song.  Get a customized station.  Try MSN Radio powered by Pandora. http://radio.msn.com/?icid=T002MSN03A07001


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to