如何在Macbook计算机上安装tomcat服务器并配置所有必需的lib

时间:2019-04-17 07:47:44

标签: macos tomcat

我在Mac上安装了tomcat9和eclipse,但是每次运行项目时,它都会给我一些错误

HTTP状态404 –未找到

和连接代码给了我一些错误也可以在服务器

上配置时间
public class DBConnection {
  public static Connection getConnectionToDatabase() {
    Connection connection = null;

    try {
        // load the driver class
        Class.forName("com.mysql.jdbc.Driver");
        System.out.println("MySQL JDBC Driver Registered!");

        // get hold of the DriverManager
        connection = DriverManager.getConnection("jdbc:mysql://localhost:portnnumber/hplus", "root", "root");
    } catch (ClassNotFoundException e) {
        System.out.println("Where is your MySQL JDBC Driver?");
        e.printStackTrace();
    } catch (SQLException e) {
        System.out.println("Connection Failed! Check output console");
        e.printStackTrace();
    }
    if (connection != null) {
        System.out.println("Connection made to DB!");
    }
    return connection;
  }
}

0 个答案:

没有答案