develog

jndi 본문

Dev/Java

jndi

냐옴 2013. 7. 18. 11:53

private static void setJndi() throws Exception {

    SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();

    builder.activate();

    

    JndiTemplate jt = new JndiTemplate();

    jt.bind("jdbc/myDB", getMyDataSource());

}


private static DriverManagerDataSource getMyDataSource() {

    DriverManagerDataSource ds = new DriverManagerDataSource();

    ds.setDriverClassName("oracle.jdbc.driver.OracleDriver");

    ds.setUrl("jdbc:oracle:thin:@127.0.0.1:1521:orcl");

    ds.setUsername("scott");

    ds.setPassword("tiger");

    return ds;

}

'Dev > Java' 카테고리의 다른 글

servlet, jsp, tomcat, java 버전별 비교  (0) 2013.07.24
REQUIRES_NEW  (0) 2013.07.18
template, callback  (0) 2013.07.17
AsyncHttpClient  (0) 2013.07.11
StringBuilder, replace  (0) 2013.07.11
Comments