Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
语句必须包含在try{}catch{}语句块中,
另外你的数据库驱动要加到tools->configure libraries里面去,并且项目中也要包含进来才行
语句必须包含在try{}catch{}语句块中,
另外你的数据库驱动要加到tools->configure libraries里面去,并且项目中也要包含进来才行
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
}catch(Exception e){}
或者还有就是在你的方法开头把它抛出去
private void method() throws ClassNotFoundException
{
}
有可能会抛出java.lang.ClassNotFoundException的异常,所以你必须捕获它并做相应的处理