Hi Magnus. Your server-side service implementation is a class that extends GWT's RemoteServiceServlet, which itself extends the Servlet interface. If you need to perform once-only initialization, you can do so by overriding the init() method in your class.
Note, however, that init() is probably a bad place to open database connections, as your backend will be accessed concurrently by many users and multiple database connections are needed. You should probably either open and close database connections inside the RPC service calls themselves (using a database connection pool behind the scenes), or in some scenarios store some resources in the user's HTTP session (acquired by calling this.getThreadLocalRequest().getSession()). If you need more help, can you send more details about your application? Shay On Jun 20, 5:23 am, Magnus <[email protected]> wrote: > Hi, > > I wonder where to open and close the database on the server side, and > where to store the database connection. > > At this point, I only have the server side implementation of my RPC > services. But there is no place to store my Connection object and no > entry point like "onServerLoad" or something like that. > > An alternative way would be to open and close the database on each > service call. > > How do you do this? > > Thank you > Magnus -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. 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.
