The code you listed creates one connection per instance (per thread in
web container). You should use connetion pooling to make sure that one
method invocation has one open connection. You can find an example in
http://www.gwtorm.com/mail/Mail.html.

Jim
http://code.google.com/p/dreamsource-orm


On May 29, 11:29 am, barclay allen <barclayal...@gmail.com> wrote:
> I want to make a gwt app with large number of concurrent users.  Users
> will run many queries.  Shouldn't I keep the connection open in this
> servlet so it can execute the queries faster like below?  In the code
> below, for every user accessing this servlet does it create a new
> connection to the database or use one connection object in the servlet
> scope?  Or should I use connection pooling?
>
> import java.sql.*;
>
> public class GreetingServiceImpl extends RemoteServiceServlet
> implements
>                 GreetingService {
>
>         private Connection connection;
>
>         public GreetingServiceImpl(){
>                 //Open the connection here
>         }
>
>         public String greetServer(String input) {
>
>                 //Use the connection here
>                 Statement stmt = connection.createStatement();
>                 ..<do JDBC work>..
>
>         }
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to