This content has been marked as final. Show 4 replies
A datasource is usually configured on server level. Your inclusion of the driver doesn't matter as long you haven't set up the necessary configuration files.1 person found this helpful
Your second example works because you don't use server level configuration.
Username and Password are required to be set if driver and url are specified.
<sql:setDataSource driver="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:ORCL" user="OE" password="pw"/>
If the dataSource attribute is used, username and password are not required.
Create a datasource JNDI. Also specify a resource-ref tag in the web.xml.
Indeed, you are right, I didn't know that I needed to modify the web.xml, neither did any of my colleague, since we just started creating small web tools with JSTL (and JSP). This fixed everything and I'm now fully able to use a DataSource defined in the WL console.
I removed the driver from my example also.
The resource-ref in the web.xml is not required for the JSTL SQL tag library. The resource-ref in web.xml for the datasource JNDI is required if the datasource JNDI lookup is used in a JSP/Servlet web application with InitialContext.