package p1;import java.sql.*;public class t4 {public static void main(string[] args){ connection con; statement sql; resultset rs; try{ class.forname(sun.jdbc.odbc.jdbcodbcdriver); } catch(classnotfoundexception e) { system.out.println(+e); } try { con=drivermanager.getconnection(jdbc:odbc:match,,); sql=con.createstatement(); rs=sql.executequery(select * from 星座); while(rs.next()) { string s=rs.getstring(1); system.out.println(s); } con.close(); } catch(sqlexception e){system.out.println(e);}}}
运行后提示: java.sql.sqlexception: [microsoft][odbc microsoft access 驱动程序] 不能打开数据库 '(未知的)'。应用程序可能无法识别该数据库,或文件可能损坏。
我在网上查了说是2007的驱动要去下载,我下载好了也安好了,还是不行。各位高手帮下小弟。
我的是access 2007,我建立一个名字为match的数据库,格式为*.accdb,里面有一个名字为 星座 的表,数据源为match,数据库也注册好了。
