Ok thanks, makes sense, Mark
On Nov 15, 10:09 am, Adam T <[EMAIL PROTECTED]> wrote: > yes and yes. > > I would recommend you check out "conection pooling" - you should be > able to get your servlet container to hold a pool of connections open > that your code can then request to use as needed. You'll need to do > two things: a) set up pooling on your container and b) change your > code slightly to use the pooled connections. > > Set up in your container is not usually difficult, but is often > container specific. For example, Tomcat can be set up as > follows:http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howt... > > Some of the principles to move from what you have in your current code > to code that uses conection pooling are in this > article:http://www.javaranch.com/journal/200601/JDBCConnectionPooling.html > > Hope that helps. > > //Adam > > On 15 Nov, 15:57, markww <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I am testing out a simple RPC call (as in the StockWatcher example). > > I'm pulling some records from a database in the service now: > > > public class MyServiceImpl extends RemoteServiceServlet > > implements IMyService > > > public Stuff[] getStuff(String criteria) > > { > > Class.forName("com.mysql.jdbc.Driver").newInstance(); > > con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/ > > test","username","password"); > > stmt = con.createStatement(); > > rs = stmt.executeQuery("SELECT * FROM blah"); > > while (rs.next()) { > > ... > > } > > } > > > return stuff; > > > } > > > It works fine, but I'm wondering about performance if I have several > > thousand users calling this webservice simultaneously - would each > > client be creating a brand new connection to my database when this RPC > > function is called? If so, is that going to hold up for large volumes > > of users? If not, can I somehow keep one db connection alive on my > > server to pass around to new clients instead of constantly > > reconnecting? > > > Thanks > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---