【发布时间】:2015-03-15 17:04:15
【问题描述】:
package connectdatabase;
import java.sql.* ;
public class ConnectDatabase {
public static void main(String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver") ;
String url = "jdbc:mysql://localhost/student" ;
Connection db = DriverManager.getConnection(url , "root" , "") ;
Statement sqlc = db.createStatement() ;
ResultSet re = sqlc.executeQuery("SELECT * FORM studentdetail ") ;
while(re.next()) {
System.out.println("product is = "+ re.getString("Stu_name")) ;
}
}
catch(Exception e){
System.out.println(e);
}
}
}
错误代码:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的“form studentdetail”附近使用正确的语法
【问题讨论】:
-
哦,大声哭泣...错误指出了您正确的问题。