-
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.
Added basic support for jndi lookup of application server managed data
sources.
- Loading branch information
skenny
committed
Mar 19, 2015
1 parent
db0fa3e
commit a4d9098
Showing
5 changed files
with
44 additions
and
1 deletion.
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