Failed to obtain JDBC Driver for MySQL under Tomcat environment

前端 未结 2 1135
别跟我提以往
别跟我提以往 2020-12-21 08:30

I\'ve been trying to obtain the Driver class for JDBC connection to MySQL. The workstation is running on Linux, Fedora 10. I have manually set up the classpath variable for

相关标签:
2条回答
  • 2020-12-21 09:15

    This shows that I've added the lastest mysql connection jar archive to my CLASSPATH variable.

    Too bad for you that Tomcat (and all other Java EE app servers) ignore any system CLASSPATH environment variable.

    You are supposed to add JDBC driver JARs in either one of two places:

    1. WEB-INF/lib for your web context, which means it's available ONLY to your app (might not be a bad thing)
    2. In the Tomcat server/lib if you're using version 5.x or /lib if you're using version 6.x.

    I believe that Tomcat 6.x requires that you put JDBC driver JARs in /lib.

    0 讨论(0)
  • 2020-12-21 09:19

    You may want to learn how to package up a war file, as that would be the simplest way to install the web application, if you are going to have several files.

    Your jar files would go in the lib directory, and would be found easily by tomcat.

    0 讨论(0)
提交回复
热议问题