title: How to use mySQL with Apache Tomcat 6
body: <p>I was using MS-Access and Tomcat 6.0 previously for my application testing and it was working fine.  </p>
  
  <p>Now I want to use mySQL database through Apache Tomcat 6.0. I have WAMP server installed on my computer and I want to connect to the mySQL server. I have succesfully created a database on it. I have put mysql-connector-java-5.1.9, mysql-5.0.85-win32 , mySQL driver in lib of tomcat 6.0 as well as that of my application to ensure it is in classpath. I have following code in my jsp.</p>
  
  <pre><code>Driver d = (Driver)Class.forName("com.mysql.jdbc.Driver").newInstance();
                      Class.forName("com.mysql.jdbc.Driver");
  Connection con=DriverManager.getConnection("jdbc:mysql:3306///tmp/mysql.sock",
                          "admin", "admin");
  
  
  
  [wampmysqld]
  port        = 3306
  socket      = /tmp/mysql.sock
  </code></pre>
  
  <p>I am getting error as</p>
  
  <pre><code>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
      at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
      at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
      at java.lang.ClassLoader.loadClassInternal(Unknown Source)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Unknown Source)
      at org.apache.jsp.insert_jsp._jspService(insert_jsp.java:78)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:574)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1527)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>What changes do I have to make in my web.xml file/server manager?</p>