I had the same problem today but found the answer in the DataSourceUtil class 
of the Jakarta implementation of JSTL. The problem is that the SQL function 
looks for the DataSource in the "java:comp/env" namespace where as your 
datasource probably is in the "java:" namespace. Mine was anyways.

The solution is to map the datasource to Tomcat using the web.xml and 
jboss-web.xml deployment descriptors:

web.xml

  |     <!-- JDBC DataSources (java:comp/env/jdbc) -->
  |     <resource-ref>
  |         <description>The used datasource</description>
  |         <res-ref-name>jdbc/DefaultDS</res-ref-name>
  |         <res-type>javax.sql.DataSource</res-type>
  |         <res-auth>Container</res-auth>
  |     </resource-ref>
  | 
jboss-web.xml

  |     <!-- make sure the web container can get jdbc connections -->
  |     <resource-ref>
  |         <res-ref-name>jdbc/DefaultDS</res-ref-name>
  |         <res-type>javax.sql.DataSource</res-type>
  |         <jndi-name>java:/pestikom2</jndi-name>
  |     </resource-ref>
  | 

The above makes the java:/pestikom2 from JBoss datasource available in the 
java:/comp/env namespace in Tomcat. The datasource can now be referenced from 
JSTL using:

  | <sql:query dataSource="jdbc/DefaultDS" var="some_var" scope="page" 
sql="select * from foo">
  | </sql:query>
  | 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3872339#3872339

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3872339


-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to