A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
how to use the datasource that has been set in tomcat
Joined: Sep 14, 2006
Sep 28, 2006 08:29:00
i know how to set Datasource in
, but i dont know how to use that Datasource name in our program. so,i kindly request you to please give solution for this problem
thanks and regards
Joined: Sep 06, 2003
Sep 29, 2006 06:49:00
The steps are as below (Note that you have to get two types of Context).
Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource) envContext.lookup("jdbc/MyApplicationDSName"); Connection conn=ds.getConnection();
I agree. Here's the link:
subject: how to use the datasource that has been set in tomcat
How to integrate SQL server with JBOSS
Servlet action is not available
How to set up DataSource in plain Java application?
datasource on tomcat 6
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014