connect to mysql problem

hi all.

i try to connect to mysql database as follow :

Class.forName("com.mysql.jdbc.Driver");

Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb?user=root&password=foo");

I added JConnector to library of eclipse and it's ok if run it on a java application , but when i run it on JSP , an exception ClassNotFound occur , i've try copy JConnector to lib directory of tomcat but nothing change .

please help me !

[481 byte] By [secmaska] at [2007-11-27 5:35:26]
# 1
Yes you need the JDBC driver in the path.Try copying the jar file to [TOMCAT]/common/libRestart Tomcat.
evnafetsa at 2007-7-12 15:04:30 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
oh , it''s ok now , thanks .i copy jar to server/lib lasttime , so tomcat can't found it.
secmaska at 2007-7-12 15:04:30 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

/server/lib is for server libraries only - ones that are not used by your web apps.

/common/lib is for server + web app

/shared/lib libraries are accessed by all web apps.

/[app]/WEB-INF/lib are for that web app only.

/common/lib is the most common place for database drivers because you can then use them with a [url http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html]JNDI Datasource[/url] rather than opening connections yourself.

evnafetsa at 2007-7-12 15:04:30 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
oh, good informations, i'll remember those . thanks you again evnafets .
secmaska at 2007-7-12 15:04:30 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...