有人可以帮我吗?我应该做什么来解决这个问题?
try
{
/*Connect to MySQL database */
Connection conn = DriverManager.getConnection(127.0.0.1, root, psswrd);
System.out.println("Connection established...");
System.out.println();
Error: Multiple markers at this line - The left-hand side of an assignment must be a variable - Syntax error on token ".0", invalid AssignmentOperator - root cannot be resolved to a variable
最佳答案
连接字符串应采用以下形式:jdbc:mysql://127.0.0.1:3306/db_name
,并且在建立连接之前应加载 mysql jdbc 驱动程序,如下所示:
Class.forName("com.mysql.jdbc.Driver");
关于java - MySQL 和 Eclipse 的连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47508838/