tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Ni" <mikeni...@hotmail.com>
Subject Re: web application - student need help
Date Fri, 05 Jan 2007 22:33:20 GMT
thx caroline


>From: Caroline Jen <jiapei_jen@yahoo.com>
>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, 5 Jan 2007 13:42:18 -0800 (PST)
>
>Did you configure a connection pool in Tomcat?  Then,
>get a connection object from the pool for each data
>search method invocation.
>
>I am at work now.  I do not have the configuration
>with me.  I can post the configuration and the
>database access code when I get home.
>
>Meanwhile, do a search on the internet.
>--- Michael Ni <mikeni123@hotmail.com> wrote:
>
> > 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
> > <dczarkowski@infinitesource.ca>
> > >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:
> > users-unsubscribe@tomcat.apache.org
> > >For additional commands, e-mail:
> > users-help@tomcat.apache.org
> > >
> >
> >
>_________________________________________________________________
> > 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:
> > users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail:
> > users-help@tomcat.apache.org
> >
> >
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>

_________________________________________________________________
>From photos to predictions, The MSN Entertainment Guide to Golden Globes has 
it all. http://tv.msn.com/tv/globes2007/?icid=nctagline1


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


Mime
View raw message