Tomcat6 can't connect to MySql (The driver has not received any packets from the server)

后端 未结 4 910
说谎
说谎 2020-12-17 01:22

i\'m running an Apache Tomcat 6.0.20 / MySQL 5.1.37-lubuntu / sun-java6-jdk /sun-java6-jre / sun-java6-bin on my local machine using Ubuntu 9.10 as OS. I\'m trying to get a

4条回答
  •  春和景丽
    2020-12-17 01:23

    Class.forName("com.mysql.jdbc.Driver");
                con=DriverManager.getConnection("jdbc:mysql://localhost:3306/indiadb","root","root");
    

    Check:

    1. the port number it must be only 3306

    2. Add the mysql.jar in lib if you are using Tomcat6

提交回复
热议问题