How to access JNDI data source defined in weblogic 10.3.6

前端 未结 3 1541
梦毁少年i
梦毁少年i 2021-01-18 00:32

I have created a JNDI data-source using my weblogic console but I am not able to access the object from my web application. Below are the details

In weblogic 10.3.6,

3条回答
  •  情歌与酒
    2021-01-18 01:05

    Tried your answer in weblogic 12c but not worked..!

    When i tried by using only the name of dataSource myDB (removed the jdbc/) it worked fine.

    Context initContext = new InitialContext();
    DataSource ds = (DataSource)initContext.lookup("myDB");
    jndiConnection = ds.getConnection();
    

提交回复
热议问题