我是 Java 的新手。
我用 Netbeans 完成了我的 Java 程序,它使用 JDBC (jdbc:mysql://localhost/inventory";)
连接到 mysql 服务器并构建了 Jar。
当我运行 jar 时,似乎无法连接 mysql,我该怎么办?我应该将 localhost 更改为我的计算机 IP 吗?
谢谢
最佳答案
您需要用户名和密码吗?如果是这样,您可能需要像这样将它添加到连接字符串中:
jdbc:mysql://localhost/inventory?user=bandi&password=yourpass
关于java - JAR 与 JDBC 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31086139/