我有一个基本的 JAVA-MySQL 连接类。但是,当我执行代码时,我得到
文件名、目录名或卷标语法不正确
错误。
我通过 wamp 服务器使用 MySQL。而且,Eclipse 是我的 IDE。
代码(MySQL_connection.java):
import java.sql.*;
public class MySQL_connection {
public static void main(String args[]) {
try {
Connection conn = DriverManager.getConnection(
"jdbc:mysql://localhost:8080/error_report","root","");
System.out.println("Connection success");
} catch (Exception e) {
System.err.println(e);
}
}
}
我已经从 phpmyadmin 创建了 error_report 数据库。
最佳答案
检查并确保您的 MySQL 配置文件的 XML 中不包含 &。 XML 文件必须使用 &
关于java - 从 JAVA (eclipse) 连接到 MySQL (wamp 服务器) 时出现 "The filename, directory name, or volume label syntax is incorrect"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30650884/