「Java」JNDI接続テストのサンプル

使用例

public void checkJNDI() throws NamingException, SQLException{  
      Context ctx = new InitialContext();  
        DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/mysql ");  
       Connection conn = ds.getConnection();  
        System.out.println(conn.isClosed());       
    }

 

Java

Posted by arkgame