aspose file tools*
The moose likes JDBC and the fly likes connecting to server DataSource using POJO. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "connecting to server DataSource using POJO. " Watch "connecting to server DataSource using POJO. " New topic
Author

connecting to server DataSource using POJO.

Andrews Arokiam
Greenhorn

Joined: Mar 18, 2011
Posts: 6
I am using the default DataSource provided along with the glassfish server (Derby). When I try to connect to it using servlets it works without any problem. But what am trying to do is use a common POJO from which I can get a Connection. So when I try to use the DataSource in a POJO it doesn't work.

I know that Servlets can refer to DataSource through resource ref and glassfish-resources.xml

Am using netbeans. Is there a way so that I can use a POJO for using DataSource. This question has come up time and again. But I couldn't find any solution. Its not that I want to use server DataSource, I want it to be declarative rather than programmatic.

I know this question has come up before but that thread is dead.


Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

Datasource within an application server can be used only by Enterprise components such as Servlet, JSP, EJB, etc...

POJO should attempt to use JDBC or any ORM frameworks to satisfy its needs.


S.D. MADHAN
Not many get the right opportunity !
 
wood burning stoves
 
subject: connecting to server DataSource using POJO.