Topic: 一个花了一个星期都未能解决的问题! |
Print this page |
1.一个花了一个星期都未能解决的问题! | Copy to clipboard |
Posted by: huangyinping Posted on: 2006-04-01 23:11 import java.sql.*; import java.sql.Connection; public class Lianxi { public static void main(String[] args) { try { try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException e){ System.out.println(e.getMessage()); } String url = "jdbc:odbc:driver={ Microsoft Access Driver (*.mdb)};DBQ=e:/db.mdb"; Connection con = DriverManager.getConnection(url, "", ""); Statement stmt = con.createStatement(); String query = "select * from user"; ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String str = rs.getString("name"); System.out.println(str); } con.close(); } catch(SQLException e){ System.out.println("*********"); System.out.println("SQLException in main:"+e.getMessage()); System.out.println("**SQLState:"+e.getSQLState()); System.out.println("**SQL Error Code:"+e.getErrorCode()); System.out.println("*********"); e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } 运行时出现以下情况,在附件里有详细结果,忘高手们驻足几分钟啊! 新建 Microsoft Word 文档 (3).doc (330.5k) |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |