jase11 jdbc connect:找不到适用于jdbc.mysql的驱动程序

时间:2019-03-01 06:34:36

标签: java mysql jdbc

import static java.lang.System.out;
import java.sql.*;
public class ConnMySql
{
    public static void main(String[] args) throws Exception
    {
        Class.forName("com.mysql.jdbc.Driver");
        try
        (
            Connection conn = DriverManager.getConnection("jdbc.mysql://127.0.0.1:3306/select_test"
                , "root", "MaYG191001&&");
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("select s.*, teacher_name"
                + " from student_table s, teacher_table t"
                + " where t.teacher_id = s.java_teacher")
            )
        {
            while(rs.next())
            {
                out.println(rs.getInt(0) + "\t" 
                    + rs.getString(1) + "\t"
                    + rs.getString(2) + "\t"
                    + rs.getString(3));
            }
        }
    }
}

当我运行此程序时,它在下面抛出异常:

  

我的Java版本是jase 11

  • 线程“主”中的异常java.sql.SQLException:没有合适的驱动程序 在以下位置找到了jdbc.mysql://127.0.0.1:3306 / select_test java.sql / java.sql.DriverManager.getConnection(DriverManager.java:702) 在 java.sql / java.sql.DriverManager.getConnection(DriverManager.java:228) 在ConnMySql.main(ConnMySql.java:10)

0 个答案:

没有答案