tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty" <mgai...@hotmail.com>
Subject Re: web application - student need help
Date Fri, 05 Jan 2007 22:28:35 GMT
start with DriverManagerConnectionFactory
http://svn.apache.org/viewvc/jakarta/commons/proper/dbcp/trunk/doc/ManualPoolingDriverExample.java?view=log

Then use a connection from the DriverManagerConnectionFactory to populate a Datasource
http://svn.apache.org/viewvc/jakarta/commons/proper/dbcp/trunk/doc/ManualPoolingDataSourceExample.java?view=log

jsp Example using PoolableConnectionFactory
http://svn.apache.org/viewvc/jakarta/commons/proper/dbcp/trunk/doc/poolingDriverExample.jocl.sample?view=log

I am not familiar with DBPoolBean (can you illustrate the location of the jars and working
sample code..?)

I found this taglib code which build an options list (from a connection obtained from a ConnectionPool)
http://archives.java.sun.com/cgi-bin/wa?A2=ind0009&L=jsp-interest&P=57293

HTH,
M-
--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of the individual
or entity to which it is addressed and may contain information that is privileged, proprietary
, confidential and exempt from disclosure. If you are not the intended recipient, you are
notified that any dissemination, distribution or copying of this communication is strictly
prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant)
s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé
ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il
est strictement interdit de le diffuser, de le distribuer ou de le reproduire.

----- Original Message ----- 
From: "Caroline Jen" <jiapei_jen@yahoo.com>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, January 05, 2007 4:42 PM
Subject: Re: web application - student need help


> 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
> 
>
Mime
View raw message