问题补充说明:import ***.sql.*;public class Ss { public static void main(String[] args) { try{ ***.forname("sun.***.jdbcodbcdriver");} catch(ClassNotFoundException e){} Connection con=***.getconnection("jdbc:odbc:ee");try{Statement sql=***.createstatement();} catch(SQLException e){} ResultSet rs=***.executequery("select * from cc");}}
嗯。这个问题很有深度,经过我来自代码粘贴和MyEclipse测试,终于知道什么问题了。主要是ResultSetrs=**台之此理控右让须息*.executequery("select*fromcc");中sql没有定义,因为sql在try,catch范围内,需要把这条与句改为:
try{
Connectioncon=***.get360问答connection("j福简权雨水溶占费容演dbc:odbc:ee");
Statementsql=***.createstatement();
ResultSetrs=***.executequery("select木注蛋若亮群编任欢矿*fromcc");}
catch(SQLExceptione){
}