Announcement

Collapse
No announcement yet.

Servlet:MySQL Driver Class not found!

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Servlet:MySQL Driver Class not found!

    Hallo,

    warum kann ich auf MySQL per standalone App. zugreifen (in Eclipse) aber nicht vom Servlet aus. Habe J/Connector-jar-Datei ins WEB-INF/lib und ins Tomcat shared/lib-Verz. gelegt.

    Aber:
    "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    ..."

    Ich kann von Eclipse 3.3 aus auch keine new Connection eintragen:
    Bei "Specify a Driver.." kann ich dann browsen und MySQL aussuchen, aber es lässt sich nicht "adden"?

    Weiss jemand woran das liegt?

    Gruß, jAlex

  • #2
    Zum Vergleich: http://www.java-forum.org/de/viewtopic.php?t=1529
    MfG
    Cheat-Sheets for Developers / Programming Quotes

    Comment


    • #3
      Hallo, also bei den Imports habe ich auch folgendes drinn:

      import com.mysql.jdbc.*;

      Hier sagt Eclipse, dass dies nicht benutzt wird und in doGet findet er dann die Klasse "Driver" nicht - es muss sich um einen Anfängerfehler handeln!?

      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      PrintWriter out = response.getWriter();

      ....


      try {
      Class.forName("com.mysql.jdbc.Driver").newInstance ();


      }

      catch (Exception e) {
      //catch (ClassNotFoundException e) {
      e.printStackTrace();
      out.println("Failer");
      return;

      }

      Comment

      Working...
      X