注册驱动

String sql = "select * from activity where activity_sub Like '%"+str+"%'";
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/form";
        String username = "root";
        String Password = "Njx200259";
        
        Connection connection = DriverManager.getConnection(url, username, Password);
        java.sql.Statement stmt = connection.createStatement();
        java.sql.ResultSet rs = stmt.executeQuery(sql);
rs.next();

rs.close();
stmt.close();

 

posted @ 2023-05-25 21:33  子过杨梅  阅读(11)  评论(0)    收藏  举报