Created
April 12, 2012 13:35
-
-
Save inancsevinc/2367302 to your computer and use it in GitHub Desktop.
@BeforeClass method responsible for creating jndi datasource for oracle
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
@BeforeClass | |
public static void setUpClass() throws Exception { | |
try { | |
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, | |
"org.apache.naming.java.javaURLContextFactory"); | |
System.setProperty(Context.URL_PKG_PREFIXES, "org.apache.naming"); | |
InitialContext ic = new InitialContext(); | |
ic.createSubcontext("jdbc"); | |
// Construct DataSource | |
OracleConnectionPoolDataSource ds = new OracleConnectionPoolDataSource(); | |
ds.setURL(DB_URL); | |
ds.setUser(DB_USERNAME); | |
ds.setPassword(DB_PASSWORD); | |
ic.bind(DATASOURCE_JNDI_NAME, ds); | |
} catch (Exception ex) { | |
ex.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment