Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I get a database pool with JNDI?

 
Jennifer Debroone
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get to the database through the database pool which is running on an application server. Can I use JNDI to do this from an application that does not run inside the application server? Or are the database pools only available for anything inside the application server? You know what I mean?

Thanks,

J.
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you get an error when you tried? The answer is yes when the app server is running. Now whether this is recommended is another question

ram.

 
Ran Pleasant
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jennifer Debroone wrote:I want to get to the database through the database pool which is running on an application server. Can I use JNDI to do this from an application that does not run inside the application server? Or are the database pools only available for anything inside the application server? You know what I mean?

Question: If you are wanting to hit an application server in order to get to a DataSource (connection pool) then why not just build a data service (EJB) on the application server and call the service rather than trying to get a JDBC connection? I'm not saying you should not do as you are planning, just that you should have a very good reason.
 
Jennifer Debroone
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ran Pleasant wrote:
Jennifer Debroone wrote:I want to get to the database through the database pool which is running on an application server. Can I use JNDI to do this from an application that does not run inside the application server? Or are the database pools only available for anything inside the application server? You know what I mean?

Question: If you are wanting to hit an application server in order to get to a DataSource (connection pool) then why not just build a data service (EJB) on the application server and call the service rather than trying to get a JDBC connection? I'm not saying you should not do as you are planning, just that you should have a very good reason.


ya, good idea, thanks for the answer !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic