控制臺(tái)報(bào)錯(cuò)
private?static?final?String?URL?=?"jdbc:mysql://localhost:3306/imooc"; private?static?final?String?USER?=?"root"; private?static?final?String?PASSWORD?=?"root"; public?static?void?main(String[]?args)?throws?Exception?{ //1、加載驅(qū)動(dòng)程序 Class.forName("com.mysql.jdbc.Driver"); //2、獲得數(shù)據(jù)庫(kù)的連接 Connection?conn?=?DriverManager.getConnection(URL,?USER,?PASSWORD); //3、通過(guò)數(shù)據(jù)庫(kù)的連接操作數(shù)據(jù)庫(kù),實(shí)現(xiàn)增刪改查 Statement?stmt?=?conn.createStatement(); ResultSet?res?=?stmt.executeQuery("select?user_name,?age?from?imooc_goddess"); while?(res.next())?{ System.out.println(res.getString("user_name")?+?","?+?res.getInt("age")); } }
哪位大神幫我看看這是為什么呀?不是build path的問(wèn)題,那個(gè)已經(jīng)配置好了,難道是因?yàn)槲矣玫氖莣orkbench???
2017-03-27
應(yīng)該是包沒(méi)倒號(hào),我也用的workbench沒(méi)事,倒包記得倒壓縮包下的jar文件