• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQLException

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I have a sessionEJB which create and active methods create connections to a database via JDBC. The EJB has a method call getData() that executes a query.
I also have a Web Application that in the first jsp creates an instance of the EJB and saves it into a session variable. In the second jsp, i get the EJB from the session variable and execute the method getData.
The EJB and WebApllication are deployed in Weblogic6.1.
The Database is shutdown every night.
In the case of weblogic6.1 in Windows plataform every thing is ok!. The problem is when the plaform is solaris. The database used is the same for Windowns and Solaris.
Every first time in a day that i try to use the web application, it throws the Exception: java.sql.SQLException: No more data to read from socket. the exception is throwned when i try to execute the method getData.
I stop the server(weblogic), start it and the problem disapears until the next morning!?!?
I am confused!!! Can anyone help me? It�s urgent!!!
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm only beginning to play with EJBs, so don't have an understanding of whether the EJB would try to hold onto a JDBC connection (and thus have a problem once the db was shut down overnight) or would create it as needed. Maybe that's the difference between the Solaris and the Windows platform. Regardless. . . as a quick fix, can you either set up a cron job to restart the server after the time that the database is restarted, or put a procedure in your database that would restart the webserver once the database is started?
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like your Connectio Pool (Data Source) connections are going stale as it loses all connections to the database when the database shuts down.
I guess you will have to somehow recreate the connection pool every morning or you can write a Connection Pool, associate it with a Timer, so that it knows when to reduce the size of the pool to zero (at night) and recreate it in the morning.
Another thing worth trying would be to have the initial size of the pool to zero, and have srink to size flag set. Its my guess that when the application is not used, the pool size will reduce to zero (at night), and when the application is up and running (morning), it will recreate all the connections. This way you will not have a stale connection.
Hope this helps...
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic