Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

DB Managed Connection

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I am trying to create a simple web page that uses JDBC and Database Connection Pooling on MySql DB. I defined the connection pool and it ran perfect, when embedding the connection code inside the jsp page.

When I tried to separate business from logic by butting database connection in a java bean, I got the following error:


my connection class or java bean is :


and I called the above bean in the jsp page as follows:



Please note that when I embed the following code inside the jsp page, the program run correctly and without error.
Any help will be appreciated, thank you in advance

jotnarta
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the constructor of the ConnectionFactory, you are creating a connection and closing it too. So the connection object in the ConnectionFactory is a closed connection. You won't be able to use it for any work.
 
Jotnarta Jot
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks buddy,, I have another question?

Where in JBoss could I define the servlet to be autoreloaded?? so that, I don't have to restart the server at each change I make

Thanks
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic