JaVa连接SQL问题
package 数据库;
import java.sql.*;
class Sql {
void Sql(){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException ex) {
System.out.println(ex.toString());
// ex.printStackTrace();
}
try {
String url="jdbc:odbc:addr";
Connection conn=DriverManager.getConnection(url);
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("slesct *form Student");
}catch (SQLException ce){
System.out.println(ce);
}
}
}
[解决办法]
ResultSet rs=stmt.executeQuery( "slesct *form Student ");
你看看你的查询语句:slesct *form Student
应该是:select * from Student 撒!!!真是晕倒!!!!
[解决办法]
sql语句错了
select * from Student