我嘗試尋找解決方案,但本網(wǎng)站上的問題并不是我要找的答案。我是菜鳥,請(qǐng)多多關(guān)照。我試過跑步private static final String USERNAME= "root";private static final String PASSWORD= "root";private static final String CONN_STRING= "jdbc:mysql//localhost:3306/java";conn Connection = null;try{ conn = DriverManager.getConnection(CONN_STRING, USERNAME, PASSWORD); System.out.println("Connected"); }catch (SQLException e){ System.err.println(e); }我正在運(yùn)行 NetBeans IDE,并且擁有 8.0.12 版本的服務(wù)器和連接器。
1 回答

炎炎設(shè)計(jì)
TA貢獻(xiàn)1808條經(jīng)驗(yàn) 獲得超4個(gè)贊
您的 JDBC URL 應(yīng)遵循 7.1 Connecting to MySQL Using the JDBC DriverManager Interface文檔中的jdbc:mysql://localhost/test
格式。
您在mysql
部分之后缺少分號(hào),應(yīng)該是
private static final String CONN_STRING = "jdbc:mysql://localhost:3306/java";
添加回答
舉報(bào)
0/150
提交
取消