0

I have a web app built in GWT running in tomcat that accesses the database. On the same server, I have some server-side Java applications running that need to use the same database connection. These applications will be deployed as a war file alongside the GWT app.

Is there a way I can send the connection from the GWT app to these server-side apps?

This isn't a whole lot of information, I understand. To me, the problem is easy enough to understand, though I haven't found a solution yet. If you need anymore information, I'll be happy to provide.

Hirak
  • 3,601
  • 1
  • 22
  • 33
Troncoso
  • 2,343
  • 3
  • 33
  • 52

3 Answers3

0

Do you mean, that the applications have to use the same jdbc connection string or is it more like a shared connection pool. Is it a solution for you to have a datasource in the local jndi and use this in your applications as well as in the servlets?

ChangeRequest
  • 532
  • 4
  • 12
0

Actually this has nothing to do with GWT.

Have a look at this answer

ServletContext provides a way of sharing objects among different servlets and even among diffrenet webapps

this.getServletConfig().getServletContext().setAttribute("sharedObject", shared); 
this.getServletConfig().getServletContext().getAttribute("sharedObject"); 
Community
  • 1
  • 1
Spiff
  • 3,873
  • 4
  • 25
  • 50
0

You cannot use the same connection in two different web apps. But if you mean to use same connection pool form which both the GWT and the other web app will fetch connections, then you need to configure the datasource at the application server level using JNDI

There are lots of JNDI tutorials using servlet in the internet.

Following is a link I found on using JNDI in GWT

http://humblecode.blogspot.in/2009/05/gwt-16-using-jndi-datasource.html

Hirak
  • 3,601
  • 1
  • 22
  • 33