JSP 2 <sql tag>

I need help linking to my mySQL DB through the web.xml file.

Currently I am using this code in each JSP:

<sql:setDataSource var="myconn"

url="jdbc:mysql://localhost/drinksDB"

user="USERNAME"

password="PASSWORD"

driver="com.mysql.jdbc.Driver" />

How can I add the reference into my web.xml file?

I thought that it went like this, but it doesn't work:

<context-param>

<param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>

<param-value>localhost:3306:drinksDB,com.mysql.jdbc.Driver,USERNAME,PASSWORD</param-value>

</context-param>

I also tried this:

<context-param>

<param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>

<param-value>jdbc:mysql://localhost/drinksDB,com.mysql.jdbc.Driver,USERNAME,PASSWORD</param-value>

</context-param>

Thanks,

Matt

Message was edited by:

MatthewWeiler

[1177 byte] By [MatthewWeilera] at [2007-11-27 9:46:35]
# 1

>Currently I am using this code in each JSP:

><sql:setDataSource var="myconn"

>url="jdbc:mysql://localhost/drinksDB"

>user="USERNAME"

>password="PASSWORD"

>driver="com.mysql.jdbc.Driver" />

>

No don't.

define your datasource in a config file. For example, if you are using tomcat, see this:http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html

what app server are you using ?

java_2006a at 2007-7-12 23:57:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thanks for the quick reply.I am using Tomcat 6.0.10.
MatthewWeilera at 2007-7-12 23:57:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...