DataSource invalid: "java.sql.SQLException: No suitable driver" — oracle-tech
I think this is a classloader problem. JSTL uses a static method DataSourceUtil.getDataSource(Object, PageContext) to lookup de datasource. It throws a java.sql.Exception, not a NamingException.
Instead of: <sql:setDataSource dataSource="YourDS" var="conn" scope="application" />
use: <% javax.naming.Context ctx = new javax.naming.InitialContext(); javax.sql.DataSource dataSource = (javax.sql.DataSource) ctx.lookup("java:YourDS"); pageContext.setAttribute("conn",dataSource); %>
이후에, JSTL sql 태그에서 dataSource를 ${conn}으로 잡으면 된다.
Instead of: <sql:setDataSource dataSource="YourDS" var="conn" scope="application" /> use: <% javax.naming.Context ctx = new javax.naming.InitialContext(); javax.sql.DataSource dataSource = (javax.sql.DataSource) ctx.lookup("java:YourDS"); pageContext.setAttribute("conn",dataSource); %>
'Programming' 카테고리의 다른 글
톰캣(tomcat)을 윈도 서비스(Windows Service)에 등록하고 설정 변경하기 (0) | 2021.09.17 |
---|---|
JSP 강의 (0) | 2021.09.17 |
PowerShell – How to add newline to string or variable? (0) | 2021.08.02 |
PowerShell로 TCP 포트 접근 테스트하기 (0) | 2021.07.22 |
Beautiful Racket / appendix: Thoughts on Racket & Chez Scheme (0) | 2021.07.15 |