-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from stuken/dev
Changes for jndi datasource lookup.
- Loading branch information
Showing
5 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/com/waratek/spiracle/sql/jndi/CreateJndiConnectionPool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.waratek.spiracle.sql.jndi; | ||
|
||
import javax.annotation.Resource; | ||
import javax.servlet.ServletContext; | ||
import javax.servlet.ServletContextEvent; | ||
import javax.servlet.ServletContextListener; | ||
import javax.servlet.annotation.WebListener; | ||
import javax.sql.DataSource; | ||
|
||
import org.apache.log4j.Logger; | ||
|
||
@WebListener | ||
public class CreateJndiConnectionPool implements ServletContextListener { | ||
private static final Logger logger = Logger.getLogger(CreateJndiConnectionPool.class); | ||
|
||
@Resource(name = "jdbc/oracle") | ||
DataSource ds; | ||
|
||
@Override | ||
public void contextDestroyed(ServletContextEvent arg0) { | ||
|
||
} | ||
|
||
@Override | ||
public void contextInitialized(ServletContextEvent arg0) { | ||
ServletContext application = arg0.getServletContext(); | ||
application.setAttribute("jndiConnectionPool", ds); | ||
logger.info("Added jndi connection pool " + ds + " to application context."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters